如果您已了解 T5,那么 FLAN-T5 在各方面都更胜一筹。在参数数量相同的情况下,这些模型在 1000 多个额外任务上进行了微调,涵盖的语言也更多。
正如摘要开头几行所述:
Flan-PaLM 540B 在多个基准测试中取得了最先进的性能,例如在五样本 MMLU 上达到 75.2%。我们还公开发布了 Flan-T5 检查点,1 即使与更大规模的模型(如 PaLM 62B)相比,也实现了强大的少样本性能。总体而言,指令微调是一种提高预训练语言模型性能和可用性的通用方法。
以下是一些关于如何在 transformers 中使用该模型的示例脚本:
from openmind import AutoTokenizer, is_torch_npu_available
from transformers import T5ForConditionalGeneration
import torch
import argparse
import time
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--model_name_or_path",
type=str,
help="Path to model",
default="JiangSuAscend/flan-t5-small",
)
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"
# 加载分词器和模型
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = T5ForConditionalGeneration.from_pretrained(model_path, trust_remote_code=True).to(device)
input_text = "A step by step recipe to make bolognese pasta:"
inputs = tokenizer(input_text, return_tensors="pt").to(model.device)
print()
print("prompt:")
print(input_text)
outputs = model.generate(**inputs)
print("result:")
print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
if __name__ == "__main__":
main()作者在原始论文的模型卡片中写道:
主要用途是语言模型研究,包括:零样本自然语言处理任务和上下文少样本学习自然语言处理任务的研究,例如推理和问答;推进公平性和安全性研究,以及理解当前大型语言模型的局限性。
有关更多详细信息,请参见研究论文。
需要更多信息。
本节以下信息复制自该模型的官方模型卡片:
Rae等人(2021)指出,包括Flan-T5在内的语言模型有可能以有害方式用于语言生成。在未针对特定应用的安全性和公平性问题进行事先评估的情况下,Flan-T5不应直接用于任何应用。
Flan-T5是在大量文本数据语料库上进行微调的,这些数据未经过显式内容过滤或现有偏见评估。因此,模型本身可能容易生成同等不适当的内容或复制基础数据中固有的偏见。
Flan-T5尚未在实际应用中进行测试。
Flan-T5不应应用于任何不可接受的用例,例如生成辱骂性言论。
根据原始论文中的模型卡片:
这些模型基于预训练的T5(Raffel等人,2020),并通过指令进行微调,以获得更好的零样本和少样本性能。每种T5模型大小对应一个经过微调的Flan模型。
该模型已在TPU v3或TPU v4 pods上进行训练,使用t5x代码库以及jax。
有关详细信息,请查阅研究论文。
FLAN-T5-Large的完整结果,请参见研究论文表3。
可使用Lacoste等人(2019)提出的机器学习影响计算器来估算碳排放量。
BibTeX格式:
@misc{https://doi.org/10.48550/arxiv.2210.11416,
doi = {10.48550/ARXIV.2210.11416},
url = {https://arxiv.org/abs/2210.11416},
author = {Chung, Hyung Won and Hou, Le and Longpre, Shayne and Zoph, Barret and Tay, Yi and Fedus, William and Li, Eric and Wang, Xuezhi and Dehghani, Mostafa and Brahma, Siddhartha and Webson, Albert and Gu, Shixiang Shane and Dai, Zhuyun and Suzgun, Mirac and Chen, Xinyun and Chowdhery, Aakanksha and Narang, Sharan and Mishra, Gaurav and Yu, Adams and Zhao, Vincent and Huang, Yanping and Dai, Andrew and Yu, Hongkun and Petrov, Slav and Chi, Ed H. and Dean, Jeff and Devlin, Jacob and Roberts, Adam and Zhou, Denny and Le, Quoc V. and Wei, Jason},
keywords = {Machine Learning (cs.LG), Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
title = {Scaling Instruction-Finetuned Language Models},
publisher = {arXiv},
year = {2022},
copyright = {Creative Commons Attribution 4.0 International}
}