Transformers documentation

FLAN-T5

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v5.22.2).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

该模型于 2022-10-20 在 HF papers 上发布,并于 2023-06-20 贡献至 Hugging Face Transformers。

FLAN-T5

概述

FLAN-T5 在论文 Scaling Instruction-Finetuned Language Models 中发布——它是 T5 的增强版本,已在多种任务的混合数据上进行了微调。

可以直接使用 FLAN-T5 的权重,而无需对模型进行微调:

from transformers import AutoModelForSeq2SeqLM, AutoTokenizer


model = AutoModelForSeq2SeqLM.from_pretrained("google/flan-t5-small", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("google/flan-t5-small")

inputs = tokenizer("A step by step recipe to make bolognese pasta:", return_tensors="pt").to(model.device)
outputs = model.generate(**inputs)
print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
['Pour a cup of bolognese into a large bowl and add the pasta']

FLAN-T5 包含了与 T5 1.1 版本相同的改进(有关模型改进的完整详情,请参见此处)。

Google 发布了以下变体:

原始检查点可以在此处找到。

有关完整的 API 参考、代码示例和笔记本,请参阅 T5 的文档页面。有关 FLAN-T5 训练和评估的更多详细信息,请参阅模型卡片。

Update on GitHub