GPT-Neo 125M 是一款基于 EleutherAI 对 GPT-3 架构复现所设计的 transformer 模型。其中,GPT-Neo 指模型类别,125M 代表该特定预训练模型的参数数量。
GPT-Neo 125M 在 Pile 数据集上进行训练,该数据集是 EleutherAI 为训练此模型而创建的大规模精选数据集。
该模型在 Pile 数据集上训练了 3000 亿个 tokens,共计 572,300 步。它作为掩码自回归语言模型进行训练,采用交叉熵损失函数。
通过这种方式,模型能够学习英语语言的内部表示,进而提取对下游任务有用的特征。不过,该模型在其预训练目标上表现最佳,即根据提示生成文本。
您可以直接通过文本生成流水线使用此模型。以下示例在每次运行时都会生成不同的序列:
from openmind import AutoTokenizer, AutoModelForCausalLM, is_torch_npu_available
from openmind_hub import snapshot_download
import torch.nn.functional as F
from torch import Tensor
import openmind
import torch
import argparse
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--model_name_or_path",
type=str,
help="Path to model",
default="jeffding/gpt-neo-125m-openmind",
)
args = parser.parse_args()
return args
def main():
args = parse_args()
model_path = args.model_name_or_path
if is_torch_npu_available():
device = "npu:0"
else:
device = "cpu"
model = model_path
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = openmind.pipeline(
"text-generation",
model=model,
torch_dtype=torch.float16,
device_map="auto",
)
sequences = pipeline(
'EleutherAI has',
do_sample=True,
top_k=10,
num_return_sequences=1,
repetition_penalty=1.5,
eos_token_id=tokenizer.eos_token_id,
max_length=500,
)
for seq in sequences:
print(f"Result: {seq['generated_text']}")
if __name__ == "__main__":
main()GPT-Neo 是作为自回归语言模型进行训练的。这意味着其核心功能是接收一段文本并预测下一个标记。尽管语言模型被广泛应用于此类任务之外的场景,但这项工作仍存在诸多未知因素。
GPT-Neo 是在 Pile 数据集上训练的,该数据集已知包含亵渎性、低俗及其他攻击性语言。根据具体使用场景,GPT-Neo 可能会生成不符合社会规范的文本。有关 Pile 数据集中偏见的更详细分析,请参见 Pile 论文的第 5 节和第 6 节。
与所有语言模型一样,很难预先预测 GPT-Neo 对特定提示的响应,且可能会在无预警的情况下出现冒犯性内容。我们建议在发布输出内容之前,由人工进行筛选或审核,以过滤不良内容并提升结果质量。
待定
待定
如需引用此模型,请使用
@software{gpt-neo,
author = {Black, Sid and
Leo, Gao and
Wang, Phil and
Leahy, Connor and
Biderman, Stella},
title = {{GPT-Neo: Large Scale Autoregressive Language
Modeling with Mesh-Tensorflow}},
month = mar,
year = 2021,
note = {{If you use this software, please cite it using
these metadata.}},
publisher = {Zenodo},
version = {1.0},
doi = {10.5281/zenodo.5297715},
url = {https://doi.org/10.5281/zenodo.5297715}
}
@article{gao2020pile,
title={The Pile: An 800GB Dataset of Diverse Text for Language Modeling},
author={Gao, Leo and Biderman, Stella and Black, Sid and Golding, Laurence and Hoppe, Travis and Foster, Charles and Phang, Jason and He, Horace and Thite, Anish and Nabeshima, Noa and others},
journal={arXiv preprint arXiv:2101.00027},
year={2020}
}
详细结果可在此处查看
| 指标 | 数值 |
|---|---|
| 平均值 | 25.79 |
| ARC(25次射击) | 22.95 |
| HellaSwag(10次射击) | 30.26 |
| MMLU(5次射击) | 25.97 |
| TruthfulQA(0次射击) | 45.58 |
| Winogrande(5次射击) | 51.78 |
| GSM8K(5次射击) | 0.3 |
| DROP(3次射击) | 3.69 |