模型概述
模型特點
模型能力
使用案例
🚀 FLAN - T5 XXL模型卡片
FLAN - T5 XXL是基於T5模型進一步優化的語言模型,在更多任務和更多語言上進行了微調,能在零樣本和少樣本學習的NLP任務中表現出色,可用於推理、問答等多種研究場景。
🚀 快速開始
模型使用示例
以下是在transformers
庫中使用該模型的示例腳本。
使用PyTorch模型
在CPU上運行模型
點擊展開
from transformers import T5Tokenizer, T5ForConditionalGeneration
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xxl")
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xxl")
input_text = "translate English to German: How old are you?"
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0]))
在GPU上運行模型
點擊展開
# pip install accelerate
from transformers import T5Tokenizer, T5ForConditionalGeneration
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xxl")
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xxl", device_map="auto")
input_text = "translate English to German: How old are you?"
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0]))
在GPU上使用不同精度運行模型
FP16
點擊展開
# pip install accelerate
import torch
from transformers import T5Tokenizer, T5ForConditionalGeneration
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xxl")
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xxl", device_map="auto", torch_dtype=torch.float16)
input_text = "translate English to German: How old are you?"
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0]))
INT8
點擊展開
# pip install bitsandbytes accelerate
from transformers import T5Tokenizer, T5ForConditionalGeneration
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xxl")
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xxl", device_map="auto", load_in_8bit=True)
input_text = "translate English to German: How old are you?"
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0]))
✨ 主要特性
支持的語言
該模型支持英語、德語、法語等多語言,具體包括英語(en)、法語(fr)、羅馬尼亞語(ro)、德語(de)以及多語言(multilingual)。
支持的任務類型
- 翻譯:如將英文句子翻譯成德文。
- 問答:回答各類問題,如“誰將成為下一屆金球獎得主”。
- 邏輯推理:對給定的邏輯問題進行推理,如判斷布爾表達式的結果。
- 科學知識問答:回答科學相關的問題,如“氮氣的沸點是多少”。
- 是非問題:通過推理回答是非問題,如“能否在一條推文中寫完一首完整的俳句”。
- 數學推理:解決數學推理問題,如根據給定條件計算數學表達式的值。
- 前提與假設判斷:判斷前提是否能推出假設。
標籤
支持文本到文本生成(text2text - generation)任務。
數據集
模型在多個數據集上進行訓練,包括:
- svakulenk0/qrecc
- taskmaster2
- djaym7/wiki_dialog
- deepmind/code_contests
- lambada
- gsm8k
- aqua_rat
- esnli
- quasc
- qed
📦 安裝指南
文檔未提及具體安裝步驟,可參考transformers
庫的安裝方式以及上述代碼示例中依賴庫的安裝命令。
📚 詳細文檔
模型詳情
模型描述
屬性 | 詳情 |
---|---|
模型類型 | 語言模型 |
支持語言(NLP) | 英語、德語、法語 |
許可證 | Apache 2.0 |
相關模型 | 所有FLAN - T5檢查點 |
原始檢查點 | 所有原始FLAN - T5檢查點 |
更多信息資源 | 研究論文、GitHub倉庫、Hugging Face FLAN - T5文檔(類似於T5) |
模型用途
直接使用和下游使用
根據原論文的模型卡片,該模型的主要用途是語言模型研究,包括零樣本NLP任務和上下文少樣本學習NLP任務的研究,如推理和問答;推進公平性和安全性研究,以及瞭解當前大語言模型的侷限性。更多詳情可查看研究論文。
超出範圍的使用
需要更多信息。
偏差、風險和侷限性
倫理考量和風險
根據模型的官方模型卡片,語言模型(包括Flan - T5)有可能被用於有害的語言生成。Flan - T5在未過濾明確內容或評估現有偏差的大量文本數據語料庫上進行了微調,因此模型本身可能容易生成不適當的內容或複製底層數據中固有的偏差。
已知侷限性
Flan - T5尚未在實際應用中進行測試。
敏感使用
Flan - T5不應應用於任何不可接受的用例,例如生成辱罵性言論。
訓練詳情
訓練數據
模型在多種任務的混合數據集上進行訓練,包括原論文圖2中描述的任務:
訓練過程
根據原論文的模型卡片,這些模型基於預訓練的T5(Raffel等人,2020),並使用指令進行微調,以獲得更好的零樣本和少樣本性能。每個T5模型大小對應一個微調後的Flan模型。模型在TPU v3或TPU v4 Pod上使用t5x
代碼庫和jax
進行訓練。
評估
測試數據、因素和指標
作者在涵蓋多種語言(總共1836種)的各種任務上對模型進行了評估。以下是一些定量評估結果:
完整詳情請查看研究論文。
評估結果
FLAN - T5 XXL的完整評估結果請查看研究論文中的表3。
環境影響
可以使用Lacoste等人(2019)提出的機器學習影響計算器來估算碳排放。
- 硬件類型:Google Cloud TPU Pods - TPU v3或TPU v4,芯片數量≥4。
- 使用時長:需要更多信息。
- 雲服務提供商:GCP
- 計算區域:需要更多信息。
- 碳排放:需要更多信息。
引用
如果使用該模型,請使用以下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}
}
📄 許可證
本模型使用Apache 2.0許可證。



