# FLAN-T5

## 概述

FLAN-T5 在论文 [Scaling Instruction-Finetuned Language Models](https://huggingface.co/papers/2210.11416) 中发布——它是 T5 的增强版本，已在多种任务的混合数据上进行了微调。

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

```python
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 版本相同的改进（有关模型改进的完整详情，请参见[此处](./t5v1.1)。）

Google 发布了以下变体：

- [google/flan-t5-small](https://huggingface.co/google/flan-t5-small)

- [google/flan-t5-base](https://huggingface.co/google/flan-t5-base)

- [google/flan-t5-large](https://huggingface.co/google/flan-t5-large)

- [google/flan-t5-xl](https://huggingface.co/google/flan-t5-xl)

- [google/flan-t5-xxl](https://huggingface.co/google/flan-t5-xxl).

原始检查点可以在[此处](https://github.com/google-research/t5x/blob/main/docs/models.md#flan-t5-checkpoints)找到。

有关所有 API 参考、代码示例和笔记本，请参阅 [T5 的文档页面](./t5)。有关 FLAN-T5 训练和评估的更多详细信息，请参阅模型卡片。

