Mt0 Xl
模型概述
模型特點
模型能力
使用案例
🚀 BLOOMZ & mT0模型介紹
我們推出了BLOOMZ和mT0系列模型,這些模型能夠在零樣本的情況下,以數十種語言遵循人類指令。我們在跨語言任務混合數據集(xP3)上對BLOOM和mT5預訓練的多語言語言模型進行微調,發現得到的模型能夠對未見的任務和語言進行跨語言泛化。
🚀 快速開始
模型使用建議
我們建議使用該模型執行自然語言表達的任務。例如,給定提示“Translate to English: Je t’aime.”,模型很可能會回答“I love you.”。以下是論文中的一些提示示例:
- 一個傳奇的開端,一個不滅的神話,這不僅僅是一部電影,而是作為一個走進新時代的標籤,永遠彪炳史冊。你認為這句話的立場是讚揚、中立還是批評?
- Suggest at least five related search terms to "Mạng neural nhân tạo".
- Write a fairy tale about a troll saving a princess from a dangerous dragon. The fairy tale is a masterpiece that has achieved praise worldwide and its moral is "Heroes Come in All Shapes and Sizes". Story (in Spanish):
- Explain in a sentence in Telugu what is backpropagation in neural networks.
歡迎在社區標籤中分享你的生成結果!
使用代碼示例
CPU
點擊展開
# pip install -q transformers
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
checkpoint = "bigscience/mt0-xl"
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)
inputs = tokenizer.encode("Translate to English: Je t’aime.", return_tensors="pt")
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0]))
GPU
點擊展開
# pip install -q transformers accelerate
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
checkpoint = "bigscience/mt0-xl"
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint, torch_dtype="auto", device_map="auto")
inputs = tokenizer.encode("Translate to English: Je t’aime.", return_tensors="pt").to("cuda")
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0]))
GPU in 8bit
點擊展開
# pip install -q transformers accelerate bitsandbytes
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
checkpoint = "bigscience/mt0-xl"
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint, device_map="auto", load_in_8bit=True)
inputs = tokenizer.encode("Translate to English: Je t’aime.", return_tensors="pt").to("cuda")
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0]))
✨ 主要特性
- 能夠在零樣本的情況下,以數十種語言遵循人類指令。
- 對未見的任務和語言具有跨語言泛化能力。
📦 安裝指南
使用該模型需要安裝transformers
庫,根據不同的使用場景,可能還需要安裝accelerate
和bitsandbytes
庫。安裝命令如下:
# CPU使用
pip install -q transformers
# GPU使用
pip install -q transformers accelerate
# GPU in 8bit使用
pip install -q transformers accelerate bitsandbytes
🔧 技術細節
模型
- 架構:與mt5-xl相同,也可參考
config.json
文件。 - 微調步驟:10000步。
- 微調令牌數:18.5億。
- 精度:bfloat16。
硬件
- TPU:TPUv4 - 128。
軟件
📚 詳細文檔
模型概述
我們推出的BLOOMZ和mT0系列模型,能夠在零樣本的情況下,以數十種語言遵循人類指令。通過在跨語言任務混合數據集(xP3)上對BLOOM和mT5預訓練的多語言語言模型進行微調,模型展現出了跨語言泛化能力。
模型使用
建議使用該模型執行自然語言表達的任務,性能可能會因提示不同而有所差異。對於BLOOMZ模型,建議明確輸入的結束位置,避免模型繼續輸入內容。同時,應儘可能為模型提供更多的上下文信息。
模型訓練
模型架構與mt5-xl相同,經過10000步微調,使用18.5億個令牌,精度為bfloat16。訓練使用TPUv4 - 128硬件,藉助T5X進行編排,基於Jax構建神經網絡。
模型評估
零樣本在未見任務上的結果可參考論文Crosslingual Generalization through Multitask Finetuning中的表7以及bigscience/evaluation-results。側邊欄報告了每個數據集配置下最佳提示的零樣本性能。
📄 許可證
本項目採用apache - 2.0
許可證。
相關信息
數據集
支持語言
該模型支持以下語言:af, am, ar, az, be, bg, bn, ca, ceb, co, cs, cy, da, de, el, en, eo, es, et, eu, fa, fi, fil, fr, fy, ga, gd, gl, gu, ha, haw, hi, hmn, ht, hu, hy, ig, is, it, iw, ja, jv, ka, kk, km, kn, ko, ku, ky, la, lb, lo, lt, lv, mg, mi, mk, ml, mn, mr, ms, mt, my, ne, nl, 'no', ny, pa, pl, ps, pt, ro, ru, sd, si, sk, sl, sm, sn, so, sq, sr, st, su, sv, sw, ta, te, tg, th, tr, uk, und, ur, uz, vi, xh, yi, yo, zh, zu。
模型指標
模型在多個任務和數據集上的評估指標如下:
任務類型 | 數據集 | 名稱 | 配置 | 分割 | 修訂版本 | 指標類型 | 值 |
---|---|---|---|---|---|---|---|
指代消解 | winogrande | Winogrande XL (xl) | xl | validation | a80f460359d1e9a67c006011c94de42a8759430c | 準確率 | 52.49 |
指代消解 | Muennighoff/xwinograd | XWinograd (en) | en | test | 9dd5ea5505fad86b7bedad667955577815300cee | 準確率 | 61.89 |
指代消解 | Muennighoff/xwinograd | XWinograd (fr) | fr | test | 9dd5ea5505fad86b7bedad667955577815300cee | 準確率 | 59.04 |
指代消解 | Muennighoff/xwinograd | XWinograd (jp) | jp | test | 9dd5ea5505fad86b7bedad667955577815300cee | 準確率 | 60.27 |
指代消解 | Muennighoff/xwinograd | XWinograd (pt) | pt | test | 9dd5ea5505fad86b7bedad667955577815300cee | 準確率 | 66.16 |
指代消解 | Muennighoff/xwinograd | XWinograd (ru) | ru | test | 9dd5ea5505fad86b7bedad667955577815300cee | 準確率 | 59.05 |
指代消解 | Muennighoff/xwinograd | XWinograd (zh) | zh | test | 9dd5ea5505fad86b7bedad667955577815300cee | 準確率 | 62.9 |
自然語言推理 | anli | ANLI (r1) | r1 | validation | 9dbd830a06fea8b1c49d6e5ef2004a08d9f45094 | 準確率 | 38.2 |
自然語言推理 | anli | ANLI (r2) | r2 | validation | 9dbd830a06fea8b1c49d6e5ef2004a08d9f45094 | 準確率 | 34.8 |
自然語言推理 | anli | ANLI (r3) | r3 | validation | 9dbd830a06fea8b1c49d6e5ef2004a08d9f45094 | 準確率 | 39 |
自然語言推理 | super_glue | SuperGLUE (cb) | cb | validation | 9e12063561e7e6c79099feb6d5a493142584e9e2 | 準確率 | 85.71 |
自然語言推理 | super_glue | SuperGLUE (rte) | rte | validation | 9e12063561e7e6c79099feb6d5a493142584e9e2 | 準確率 | 78.7 |
自然語言推理 | xnli | XNLI (ar) | ar | validation | a5a45e4ff92d5d3f34de70aaf4b72c3bdf9f7f16 | 準確率 | 51.85 |
自然語言推理 | xnli | XNLI (bg) | bg | validation | a5a45e4ff92d5d3f34de70aaf4b72c3bdf9f7f16 | 準確率 | 54.18 |
自然語言推理 | xnli | XNLI (de) | de | validation | a5a45e4ff92d5d3f34de70aaf4b72c3bdf9f7f16 | 準確率 | 54.78 |
自然語言推理 | xnli | XNLI (el) | el | validation | a5a45e4ff92d5d3f34de70aaf4b72c3bdf9f7f16 | 準確率 | 53.78 |
自然語言推理 | xnli | XNLI (en) | en | validation | a5a45e4ff92d5d3f34de70aaf4b72c3bdf9f7f16 | 準確率 | 56.83 |
自然語言推理 | xnli | XNLI (es) | es | validation | a5a45e4ff92d5d3f34de70aaf4b72c3bdf9f7f16 | 準確率 | 54.78 |
自然語言推理 | xnli | XNLI (fr) | fr | validation | a5a45e4ff92d5d3f34de70aaf4b72c3bdf9f7f16 | 準確率 | 54.22 |
自然語言推理 | xnli | XNLI (hi) | hi | validation | a5a45e4ff92d5d3f34de70aaf4b72c3bdf9f7f16 | 準確率 | 50.24 |
自然語言推理 | xnli | XNLI (ru) | ru | validation | a5a45e4ff92d5d3f34de70aaf4b72c3bdf9f7f16 | 準確率 | 53.09 |
自然語言推理 | xnli | XNLI (sw) | sw | validation | a5a45e4ff92d5d3f34de70aaf4b72c3bdf9f7f16 | 準確率 | 49.6 |
自然語言推理 | xnli | XNLI (th) | th | validation | a5a45e4ff92d5d3f34de70aaf4b72c3bdf9f7f16 | 準確率 | 52.13 |
自然語言推理 | xnli | XNLI (tr) | tr | validation | a5a45e4ff92d5d3f34de70aaf4b72c3bdf9f7f16 | 準確率 | 50.56 |
自然語言推理 | xnli | XNLI (ur) | ur | validation | a5a45e4ff92d5d3f34de70aaf4b72c3bdf9f7f16 | 準確率 | 47.91 |
自然語言推理 | xnli | XNLI (vi) | vi | validation | a5a45e4ff92d5d3f34de70aaf4b72c3bdf9f7f16 | 準確率 | 53.21 |
自然語言推理 | xnli | XNLI (zh) | zh | validation | a5a45e4ff92d5d3f34de70aaf4b72c3bdf9f7f16 | 準確率 | 50.64 |
程序合成 | openai_humaneval | HumanEval | None | test | e8dc562f5de170c54b5481011dd9f4fa04845771 | Pass@1 | 0 |
程序合成 | openai_humaneval | HumanEval | None | test | e8dc562f5de170c54b5481011dd9f4fa04845771 | Pass@10 | 0 |
程序合成 | openai_humaneval | HumanEval | None | test | e8dc562f5de170c54b5481011dd9f4fa04845771 | Pass@100 | 0 |
句子完成 | story_cloze | StoryCloze (2016) | '2016' | validation | e724c6f8cdf7c7a2fb229d862226e15b023ee4db | 準確率 | 79.1 |
句子完成 | super_glue | SuperGLUE (copa) | copa | validation | 9e12063561e7e6c79099feb6d5a493142584e9e2 | 準確率 | 72 |
句子完成 | xcopa | XCOPA (et) | et | validation | 37f73c60fb123111fa5af5f9b705d0b3747fd187 | 準確率 | 70 |
句子完成 | xcopa | XCOPA (ht) | ht | validation | 37f73c60fb123111fa5af5f9b705d0b3747fd187 | 準確率 | 66 |
句子完成 | xcopa | XCOPA (id) | id | validation | 37f73c60fb123111fa5af5f9b705d0b3747fd187 | 準確率 | 71 |
句子完成 | xcopa | XCOPA (it) | it | validation | 37f73c60fb123111fa5af5f9b705d0b3747fd187 | 準確率 | 70 |
句子完成 | xcopa | XCOPA (qu) | qu | validation | 37f73c60fb123111fa5af5f9b705d0b3747fd187 | 準確率 | 56 |
句子完成 | xcopa | XCOPA (sw) | sw | validation | 37f73c60fb123111fa5af5f9b705d0b3747fd187 | 準確率 | 53 |
句子完成 | xcopa | XCOPA (ta) | ta | validation | 37f73c60fb123111fa5af5f9b705d0b3747fd187 | 準確率 | 64 |
句子完成 | xcopa | XCOPA (th) | th | validation | 37f73c60fb123111fa5af5f9b705d0b3747fd187 | 準確率 | 60 |
句子完成 | xcopa | XCOPA (tr) | tr | validation | 37f73c60fb123111fa5af5f9b705d0b3747fd187 | 準確率 | 58 |
句子完成 | xcopa | XCOPA (vi) | vi | validation | 37f73c60fb123111fa5af5f9b705d0b3747fd187 | 準確率 | 68 |
句子完成 | xcopa | XCOPA (zh) | zh | validation | 37f73c60fb123111fa5af5f9b705d0b3747fd187 | 準確率 | 65 |
句子完成 | Muennighoff/xstory_cloze | XStoryCloze (ar) | ar | validation | 8bb76e594b68147f1a430e86829d07189622b90d | 準確率 | 70.09 |
句子完成 | Muennighoff/xstory_cloze | XStoryCloze (es) | es | validation | 8bb76e594b68147f1a430e86829d07189622b90d | 準確率 | 77.17 |
句子完成 | Muennighoff/xstory_cloze | XStoryCloze (eu) | eu | validation | 8bb76e594b68147f1a430e86829d07189622b90d | 準確率 | 69.03 |
句子完成 | Muennighoff/xstory_cloze | XStoryCloze (hi) | hi | validation | 8bb76e594b68147f1a430e86829d07189622b90d | 準確率 | 71.08 |
句子完成 | Muennighoff/xstory_cloze | XStoryCloze (id) | id | validation | 8bb76e594b68147f1a430e86829d07189622b90d | 準確率 | 75.71 |
句子完成 | Muennighoff/xstory_cloze | XStoryCloze (my) | my | validation | 8bb76e594b68147f1a430e86829d07189622b90d | 準確率 | 65.65 |
句子完成 | Muennighoff/xstory_cloze | XStoryCloze (ru) | ru | validation | 8bb76e594b68147f1a430e86829d07189622b90d | 準確率 | 74.85 |
句子完成 | Muennighoff/xstory_cloze | XStoryCloze (sw) | sw | validation | 8bb76e594b68147f1a430e86829d07189622b90d | 準確率 | 71.14 |
句子完成 | Muennighoff/xstory_cloze | XStoryCloze (te) | te | validation | 8bb76e594b68147f1a430e86829d07189622b90d | 準確率 | 68.89 |
句子完成 | Muennighoff/xstory_cloze | XStoryCloze (zh) | zh | validation | 8bb76e594b68147f1a430e86829d07189622b90d | 準確率 | 72.93 |
BLOOMZ & mT0模型家族
微調數據集 | 參數 | 300M | 580M | 1.2B | 3.7B | 13B | 560M | 1.1B | 1.7B | 3B | 7.1B | 176B |
---|---|---|---|---|---|---|---|---|---|---|---|---|
在xP3上進行多任務微調。推薦用英語進行提示。 | 微調模型 | [mt0 - small](https://huggingface.co/bigscience/mt0 - small) | [mt0 - base](https://huggingface.co/bigscience/mt0 - base) | [mt0 - large](https://huggingface.co/bigscience/mt0 - large) | [mt0 - xl](https://huggingface.co/bigscience/mt0 - xl) | [mt0 - xxl](https://huggingface.co/bigscience/mt0 - xxl) | [bloomz - 560m](https://huggingface.co/bigscience/bloomz - 560m) | [bloomz - 1b1](https://huggingface.co/bigscience/bloomz - 1b1) | [bloomz - 1b7](https://huggingface.co/bigscience/bloomz - 1b7) | [bloomz - 3b](https://huggingface.co/bigscience/bloomz - 3b) | [bloomz - 7b1](https://huggingface.co/bigscience/bloomz - 7b1) | bloomz |
在xP3mt上進行多任務微調。推薦用非英語進行提示。 | 微調模型 | [mt0 - xxl - mt](https://huggingface.co/bigscience/mt0 - xxl - mt) | [bloomz - 7b1 - mt](https://huggingface.co/bigscience/bloomz - 7b1 - mt) | [bloomz - mt](https://huggingface.co/bigscience/bloomz - mt) | ||||||||
在P3上進行多任務微調。僅用於研究目的。嚴格劣於上述模型! | 微調模型 | [mt0 - xxl - p3](https://huggingface.co/bigscience/mt0 - xxl - p3) | [bloomz - 7b1 - p3](https://huggingface.co/bigscience/bloomz - 7b1 - p3) | [bloomz - p3](https://huggingface.co/bigscience/bloomz - p3) | ||||||||
原始預訓練檢查點。不推薦。 | 預訓練模型 | [mt5 - small](https://huggingface.co/google/mt5 - small) | [mt5 - base](https://huggingface.co/google/mt5 - base) | [mt5 - large](https://huggingface.co/google/mt5 - large) | [mt5 - xl](https://huggingface.co/google/mt5 - xl) | [mt5 - xxl](https://huggingface.co/google/mt5 - xxl) | [bloom - 560m](https://huggingface.co/bigscience/bloom - 560m) | [bloom - 1b1](https://huggingface.co/bigscience/bloom - 1b1) | [bloom - 1b7](https://huggingface.co/bigscience/bloom - 1b7) | [bloom - 3b](https://huggingface.co/bigscience/bloom - 3b) | [bloom - 7b1](https://huggingface.co/bigscience/bloom - 7b1) | bloom |
引用
如果您使用了該模型,請引用以下論文:
@article{muennighoff2022crosslingual,
title={Crosslingual generalization through multitask finetuning},
author={Muennighoff, Niklas and Wang, Thomas and Sutawika, Lintang and Roberts, Adam and Biderman, Stella and Scao, Teven Le and Bari, M Saiful and Shen, Sheng and Yong, Zheng-Xin and Schoelkopf, Hailey and others},
journal={arXiv preprint arXiv:2211.01786},
year={2022}
}
聯繫信息
- 倉庫:[bigscience - workshop/xmtf](https://github.com/bigscience - workshop/xmtf)
- 論文:Crosslingual Generalization through Multitask Finetuning
- 聯繫人:Niklas Muennighoff
模型使用限制
提示工程:模型性能可能會因提示不同而有所差異。對於BLOOMZ模型,建議明確輸入的結束位置,避免模型繼續輸入內容。例如,提示“Translate to English: Je t'aime”末尾沒有句號(.),可能會導致模型繼續續寫法語句子。更好的提示示例有“Translate to English: Je t'aime.”、“Translate to English: Je t'aime. Translation:”、“What is "Je t'aime." in English?”,這些提示能讓模型明確何時開始回答。此外,建議為模型提供儘可能多的上下文信息。例如,如果希望模型用泰盧固語回答,可告知模型,如“Explain in a sentence in Telugu what is backpropagation in neural networks.”。
模型小部件示例
示例標題 | 文本 |
---|---|
zh - en sentiment | 一個傳奇的開端,一個不滅的神話,這不僅僅是一部電影,而是作為一個走進新時代的標籤,永遠彪炳史冊。Would you rate the previous review as positive, neutral or negative? |
zh - zh sentiment | 一個傳奇的開端,一個不滅的神話,這不僅僅是一部電影,而是作為一個走進新時代的標籤,永遠彪炳史冊。你認為這句話的立場是讚揚、中立還是批評? |
vi - en query | Suggest at least five related search terms to "Mạng neural nhân tạo". |
fr - fr query | Proposez au moins cinq mots clés concernant «Réseau de neurones artificiels». |
te - en qa | Explain in a sentence in Telugu what is backpropagation in neural networks. |
en - en qa | Why is the sky blue? |
es - en fable | Write a fairy tale about a troll saving a princess from a dangerous dragon. The fairy tale is a masterpiece that has achieved praise worldwide and its moral is "Heroes Come in All Shapes and Sizes". Story (in Spanish): |
hi - en fable | Write a fable about wood elves living in a forest that is suddenly invaded by ogres. The fable is a masterpiece that has achieved praise worldwide and its moral is "Violence is the last refuge of the incompetent". Fable (in Hindi): |



