模型:
bigscience/bloomz-1b1
我们提出了BLOOMZ & mT0模型系列,能够在多种语言中零-shot跟随人类指令。我们对BLOOM和mT5进行微调,预训练的多语言语言模型在我们的跨语言任务混合(xP3)上,并发现得到的模型能够在未见任务和语言上具有跨语言泛化能力。
Multitask finetuned on 1239321 . Recommended for prompting in English. | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Parameters | 300M | 580M | 1.2B | 3.7B | 13B | 560M | 1.1B | 1.7B | 3B | 7.1B | 176B |
Finetuned Model | 12310321 | 12311321 | 12312321 | 12313321 | 12314321 | 12315321 | 12316321 | 12317321 | 12318321 | 12319321 | 12320321 |
Multitask finetuned on 12321321 . Recommended for prompting in non-English. | |||||||||||
Finetuned Model | 12322321 | 12323321 | 12324321 | ||||||||
Multitask finetuned on 12325321 . Released for research purposes only. Strictly inferior to above models! | |||||||||||
Finetuned Model | 12326321 | 12327321 | 12328321 | ||||||||
Original pretrained checkpoints. Not recommended. | |||||||||||
Pretrained Model | 12329321 | 12330321 | 12331321 | 12332321 | 12333321 | 12334321 | 12335321 | 12336321 | 12337321 | 12338321 | 12339321 |
我们建议使用模型来执行自然语言表达的任务。例如,给定提示“将其翻译成英语:Je t’aime。”,模型很可能会回答“我爱你”。我们论文中的一些提示点子:
欢迎在社区标签中分享您的生成内容!
# pip install -q transformers from transformers import AutoModelForCausalLM, AutoTokenizer checkpoint = "bigscience/bloomz-1b1" tokenizer = AutoTokenizer.from_pretrained(checkpoint) model = AutoModelForCausalLM.from_pretrained(checkpoint) inputs = tokenizer.encode("Translate to English: Je t’aime.", return_tensors="pt") outputs = model.generate(inputs) print(tokenizer.decode(outputs[0]))
# pip install -q transformers accelerate from transformers import AutoModelForCausalLM, AutoTokenizer checkpoint = "bigscience/bloomz-1b1" tokenizer = AutoTokenizer.from_pretrained(checkpoint) model = AutoModelForCausalLM.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]))
# pip install -q transformers accelerate bitsandbytes from transformers import AutoModelForCausalLM, AutoTokenizer checkpoint = "bigscience/bloomz-1b1" tokenizer = AutoTokenizer.from_pretrained(checkpoint) model = AutoModelForCausalLM.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]))
提示工程:性能可能因提示而异。对于BLOOMZ模型,我们建议在输入结束时清楚地指示,以避免模型尝试继续句子。例如,没有末尾的句点(.)的提示“将其翻译成英语:Je t'aime”可能导致模型尝试继续法语句子。更好的提示示例包括“将其翻译成英语:Je t'aime。”,“将其翻译成英语:Je t'aime。翻译:”,“Je t'aime.”在英语中是什么意思?在这些提示中,模型可以清楚地知道应该回答的时间点。此外,我们建议尽可能地提供模型所需的上下文。例如,如果您希望它用泰卢固语回答,请告诉模型,例如“用泰卢固语用一句话解释神经网络中的反向传播是什么。”。
我们参考我们的 paper 和 bigscience/evaluation-results 中的表 7,以获得未见任务的零-shot结果。侧边栏报告了每个数据集配置的最佳提示的零-shot性能。
@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} }