Transformers documentation
FLAN-T5
Get started
Base classes
Models
Preprocessors
Inference
Pipeline API
Generate API
Optimization
Chat with models
Serving
Training
Quantization
Ecosystem integrations
Resources
API
Main Classes
Models
Text models
AFMoEALBERTApertusArceeBambaBARTBARThezBARTphoBERTBertGenerationBertJapaneseBERTweetBigBirdBigBirdPegasusBioGptBitNetBlenderbotBlenderbot SmallBLOOMBLTByT5CamemBERTCANINECodeGenCodeLlamaCohereCohere2ConvBERTCPMCPMANTCTRLDBRXDeBERTaDeBERTa-v2DeepSeek-V2DeepSeek-V3DialoGPTDiffLlamaDistilBERTDogedots1DPRELECTRAEncoder Decoder ModelsERNIEErnie4_5Ernie4_5_MoEESMEuroBERTEXAONE-4.0EXAONE-MoEFalconFalcon3FalconH1FalconMambaFLAN-T5FLAN-UL2FlauBERTFlexOlmoFNetFSMTFunnel TransformerFuyuGemmaGemma2GLM-4GLM-4-0414GLM-4.5, GLM-4.6, GLM-4.7GLM-4.7-FlashGLM-ImageGlmMoeDsaGPTGPT NeoGPT NeoXGPT NeoX JapaneseGPT-JGPT2GPTBigCodeGptOssGPTSw3GraniteGraniteMoeGraniteMoeHybridGraniteMoeSharedHeliumHerBERTHunYuanDenseV1HunYuanMoEV1HYV3I-BERTJais2JambaJetMoejina_embeddings_v3LEDLFM2LFM2MoeLLaMALlama2Llama3LongCatFlashLongformerLongT5LUKEM2M100MADLAD-400MambaMamba2MarianMTMarkupLMMBart and MBart-50MegatronBERTMegatronGPT2MiniMaxMiniMax-M2MinistralMinistral3MistralMixtralmLUKEMobileBERTModernBertModernBERTDecoderModernVBertMPNetMPTMRAMT5MVPmyt5NanoChatNemotronNemotronHNLLBNLLB-MoENomicBERTNyströmformerOLMoOLMo2Olmo3OLMoEOlmoHybridOpenAI Privacy FilterOPTPegasusPEGASUS-XPersimmonPhiPhi-3PhiMoEPhoBERTPLBartProphetNetQwen2Qwen2MoEQwen3Qwen3.5Qwen3.5 MoeQwen3MoEQwen3NextRAGRecurrentGemmaReformerRemBERTRoBERTaRoBERTa-PreLayerNormRoCBertRoFormerRWKVSeed-OssSolarOpenSplinterSqueezeBERTStableLmStarcoder2SwitchTransformersT5T5GemmaT5Gemma2T5v1.1UL2UMT5VaultGemmaX-MODXGLMXLMXLM-RoBERTaXLM-RoBERTa-XLXLM-VXLNetxLSTMYOSOYoutu-LLMZambaZamba2
Vision models
Audio models
Video models
Multimodal models
Reinforcement learning models
Time series models
Internal helpers
Reference
You are viewing v5.6.1 version. A newer version v5.8.1 is available.
This model was released on 2022-10-20 and added to Hugging Face Transformers on 2023-06-20.
FLAN-T5
Overview
FLAN-T5 was released in the paper Scaling Instruction-Finetuned Language Models - it is an enhanced version of T5 that has been finetuned in a mixture of tasks.
One can directly use FLAN-T5 weights without finetuning the model:
>>> from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
>>> model = AutoModelForSeq2SeqLM.from_pretrained("google/flan-t5-small")
>>> tokenizer = AutoTokenizer.from_pretrained("google/flan-t5-small")
>>> inputs = tokenizer("A step by step recipe to make bolognese pasta:", return_tensors="pt")
>>> 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 includes the same improvements as T5 version 1.1 (see here for the full details of the model’s improvements.)
Google has released the following variants:
The original checkpoints can be found here.
Update on GitHubRefer to T5’s documentation page for all API reference, code examples and notebooks. For more details regarding training and evaluation of the FLAN-T5, refer to the model card.