对 Bloom 的怀旧

Reddit r/LocalLLaMA 模型

摘要

BLOOMZ 和 mT0 是在跨语言任务混合 xP3 上微调的多语言模型,能够在数十种语言中实现零样本指令遵循。

暂无内容
查看原文
查看缓存全文

缓存时间: 2026/07/10 22:27

bigscience/bloomz-p3 · Hugging Face

来源:https://huggingface.co/bigscience/bloomz-p3 xmtf (https://github.com/bigscience-workshop/xmtf/blob/master/xmtf_banner.png?raw=true)

https://huggingface.co/bigscience/bloomz-p3#table-of-contents目录

  1. 模型摘要 (https://huggingface.co/bigscience/bloomz-p3#模型摘要)
  2. 使用 (https://huggingface.co/bigscience/bloomz-p3#使用)
  3. 局限性 (https://huggingface.co/bigscience/bloomz-p3#局限性)
  4. 训练 (https://huggingface.co/bigscience/bloomz-p3#训练)
  5. 评估 (https://huggingface.co/bigscience/bloomz-p3#评估)
  6. 引用 (https://huggingface.co/bigscience/bloomz-p3#引用)

https://huggingface.co/bigscience/bloomz-p3#模型摘要模型摘要

我们提出了 BLOOMZ 和 mT0,这是一系列能够在数十种语言中零样本遵循人类指令的模型。我们在跨语言任务混合数据集 xP3 上对预训练的多语言语言模型 BLOOM 和 mT5 进行微调,并发现由此产生的模型能够对未见过的任务和语言进行跨语言泛化。

  • 仓库: bigscience-workshop/xmtf (https://github.com/bigscience-workshop/xmtf)
  • 论文: 通过多任务微调实现跨语言泛化 (https://arxiv.org/abs/2211.01786)
  • 联系人: Niklas Muennighoff
  • 语言: 预训练语言比例请参考 bloom (https://huggingface.co/bigscience/bloom),微调语言比例请参考 xP3 (https://huggingface.co/datasets/bigscience/xP3)。模型能够理解预训练和微调中所使用的语言。
  • BLOOMZ 和 mT0 模型家族:

https://huggingface.co/bigscience/bloomz-p3#使用使用

https://huggingface.co/bigscience/bloomz-p3#预期用途预期用途

我们建议使用该模型来执行以自然语言表达的任务。例如,给定提示“翻译成英文: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.

欢迎在社区标签中分享您的生成内容!

https://huggingface.co/bigscience/bloomz-p3#如何使用如何使用

https://huggingface.co/bigscience/bloomz-p3#cpuCPU

点击展开``

pip install -q transformers

from transformers import AutoModelForCausalLM, AutoTokenizer

checkpoint = “bigscience/bloomz-p3”

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])) ``

https://huggingface.co/bigscience/bloomz-p3#gpuGPU

点击展开``

pip install -q transformers accelerate

from transformers import AutoModelForCausalLM, AutoTokenizer

checkpoint = “bigscience/bloomz-p3”

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])) ``

https://huggingface.co/bigscience/bloomz-p3#8位gpuGPU 8 位

点击展开``

pip install -q transformers accelerate bitsandbytes

from transformers import AutoModelForCausalLM, AutoTokenizer

checkpoint = “bigscience/bloomz-p3”

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])) ``

https://huggingface.co/bigscience/bloomz-p3#

https://huggingface.co/bigscience/bloomz-p3#局限性局限性

提示工程: 性能可能因提示而异。对于 BLOOMZ 模型,我们建议在输入结束时非常明确,以避免模型尝试继续输入。例如,提示“翻译成英文:Je t’aime”末尾没有句号(.),可能导致模型尝试继续法语句子。更好的提示如“翻译成英文:Je t’aime。”、“翻译成英文:Je t’aime。译文:”、““Je t’aime。”用英文怎么说?”,这样模型就能清楚地知道何时回答。此外,我们建议尽可能为模型提供更多上下文。例如,如果您希望模型用泰卢固语回答,则告诉模型,如“用一个泰卢固语句子解释什么是神经网络中的反向传播。”。

https://huggingface.co/bigscience/bloomz-p3#训练训练

https://huggingface.co/bigscience/bloomz-p3#模型模型

  • 架构: 与 bloom (https://huggingface.co/bigscience/bloom) 相同,也请参考 config.json 文件
  • 微调步数: 498
  • 微调令牌数: 20.9 亿
  • 微调布局: 72 路流水线并行,1 路张量并行,4 路数据并行
  • 精度: bfloat16

https://huggingface.co/bigscience/bloomz-p3#硬件硬件

  • CPU: AMD CPU,每节点 512GB 内存
  • GPU: 288 块 A100 80GB GPU,每节点 8 块 GPU(共 36 个节点),使用 NVLink 4 进行 GPU 间互连,4 条 OmniPath 链路
  • 通信: NCCL 通信网络,配有完全专用的子网

https://huggingface.co/bigscience/bloomz-p3#软件软件

  • 编排: Megatron-DeepSpeed (https://github.com/bigscience-workshop/Megatron-DeepSpeed)
  • 优化器和并行性: DeepSpeed (https://github.com/microsoft/DeepSpeed)
  • 神经网络: PyTorch (https://github.com/pytorch/pytorch)(pytorch-1.11 搭配 CUDA-11.5)
  • FP16(若适用): apex (https://github.com/NVIDIA/apex)

https://huggingface.co/bigscience/bloomz-p3#评估评估

对于在未见任务上的零样本结果,我们参考论文 (https://arxiv.org/abs/2211.01786) 的表 7 和 bigscience/evaluation-results (https://huggingface.co/datasets/bigscience/evaluation-results)。侧边栏报告了每个数据集配置最佳提示的零样本性能。

https://huggingface.co/bigscience/bloomz-p3#引用引用

@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} }

相似文章

tencent/Hy-MT2-7B

Hugging Face Models Trending

腾讯开源了Hy-MT2系列快速思考的多语言翻译模型(1.8B、7B、30B-A3B),支持33种语言,同时提供了用于设备端部署的极端量化方法以及一个新的指令遵循基准IFMTBench。

Multilingual-Multimodal-NLP/LoopCoder-V2 · Hugging Face

Reddit r/LocalLLaMA

LoopCoder-V2 是一个基于 Parallel Loop Transformer (PLT) 构建的 7B 参数指令调优代码模型,展示了非单调测试时扩展特性,其中两个循环提供了最佳的收益-成本权衡,并在代码生成和推理基准测试上显著优于基线模型。