---
title: bloomz-7b1-mt
canonical_url: "https://www.modelscope.cn/models/AI-ModelScope/bloomz-7b1-mt"
md_url: "https://www.modelscope.cn/models/AI-ModelScope/bloomz-7b1-mt.md"
repository: AI-ModelScope/bloomz-7b1-mt
last_updated: 2023-07-13
license: "Apache License 2.0"
pipeline_tag: text-generation
tasks:
  - text-generation
model_type:
  - bloom
architectures:
  - BloomForCausalLM
library_name:
  - transformer
  - pytorch
frameworks:
  - pytorch
domain:
  - nlp
inference_backends:
  - "deploy_task text/emb"
  - "vllm 0.9.2"
downloads: 461
stars: 0
tags:
  - transformer
  - LLM
  - ChatGPT
  - generation
---

# bloomz-7b1-mt

> bloomz-7b1-mt - AI-ModelScope 在 ModelScope 开源的模型。Use How to use CPU Click to expand

AI-ModelScope/bloomz-7b1-mt 是 ModelScope 魔搭社区上的text-generation模型，采用 Apache License 2.0 许可，可用 deploy_task text/emb、vllm 0.9.2 部署。

- **Repository**: AI-ModelScope/bloomz-7b1-mt
- **License**: Apache License 2.0
- **Tasks**: text-generation
- **Inference backends**: deploy_task text/emb, vllm 0.9.2
- **Tags**: transformer, LLM, ChatGPT, generation
- **Downloads**: 461
- **Stars**: 0
- **Last updated**: 2023-07-13

Source: https://www.modelscope.cn/models/AI-ModelScope/bloomz-7b1-mt

---

# Use
 
## How to use
 
### CPU
 
<details>
<summary> Click to expand </summary>
 
```python
# pip install -q transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
 
checkpoint = "bigscience/bloomz-7b1-mt"
 
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]))
```
 
</details>
 
### GPU
 
<details>
<summary> Click to expand </summary>
 
```python
# pip install -q transformers accelerate
from transformers import AutoModelForCausalLM, AutoTokenizer
 
checkpoint = "bigscience/bloomz-7b1-mt"
 
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]))
```
 
</details>
 
### GPU in 8bit
 
<details>
<summary> Click to expand </summary>
 
```python
# pip install -q transformers accelerate bitsandbytes
from transformers import AutoModelForCausalLM, AutoTokenizer
 
checkpoint = "bigscience/bloomz-7b1-mt"
 
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]))
```
 
</details>
 
<!-- Necessary for whitespace -->
###
 
# Limitations
 
**Prompt Engineering:** The performance may vary depending on the prompt. For BLOOMZ models, we recommend making it very clear when the input stops to avoid the model trying to continue it. For example, the prompt "*Translate to English: Je t'aime*" without the full stop (.) at the end, may result in the model trying to continue the French sentence. Better prompts are e.g. "*Translate to English: Je t'aime.*", "*Translate to English: Je t'aime. Translation:*" "*What is "Je t'aime." in English?*", where it is clear for the model when it should answer. Further, we recommend providing the model as much context as possible. For example, if you want it to answer in Telugu, then tell the model, e.g. "*Explain in a sentence in Telugu what is backpropagation in neural networks.*".
 
# Training
 
## Model
 
- **Architecture:** Same as [bloom-7b1](https://huggingface.co/bigscience/bloom-7b1), also refer to the `config.json` file
- **Finetuning steps:** 1000
- **Finetuning tokens:** 4.19 billion
- **Finetuning layout:** 1x pipeline parallel, 1x tensor parallel, 64x data parallel
- **Precision:** float16
 
## Hardware
 
- **CPUs:** AMD CPUs with 512GB memory per node
- **GPUs:** 64 A100 80GB GPUs with 8 GPUs per node (8 nodes) using NVLink 4 inter-gpu connects, 4 OmniPath links
- **Communication:** NCCL-communications network with a fully dedicated subnet
 
## Software
 
- **Orchestration:** [Megatron-DeepSpeed](https://github.com/bigscience-workshop/Megatron-DeepSpeed)
- **Optimizer & parallelism:** [DeepSpeed](https://github.com/microsoft/DeepSpeed)
- **Neural networks:** [PyTorch](https://github.com/pytorch/pytorch) (pytorch-1.11 w/ CUDA-11.5)
- **FP16 if applicable:** [apex](https://github.com/NVIDIA/apex)
 
# Evaluation
 
We refer to Table 7 from our [paper](https://arxiv.org/abs/2211.01786) & [bigscience/evaluation-results](https://huggingface.co/datasets/bigscience/evaluation-results) for zero-shot results on unseen tasks. The sidebar reports zero-shot performance of the best prompt per dataset config.
 

## 示例代码
```python
from modelscope.utils.constant import Tasks
from modelscope.pipelines import pipeline
pipe = pipeline(task=Tasks.text_generation, model='AI-ModelScope/bloomz-7b1-mt', model_revision='v1.0.2', device_map='auto')
inputs="Translate to English: Je t’aime."
result = pipe(inputs, max_new_tokens=1024, do_sample=True, top_p=0.85, temperature=1.0, repetition_penalty=1., eos_token_id=2, bos_token_id=1, pad_token_id=0)
print(result['text'])
```
# Citation
```bibtex
@misc{muennighoff2022crosslingual,
      title={Crosslingual Generalization through Multitask Finetuning}, 
      author={Niklas Muennighoff and Thomas Wang and Lintang Sutawika and Adam Roberts and Stella Biderman and Teven Le Scao and M Saiful Bari and Sheng Shen and Zheng-Xin Yong and Hailey Schoelkopf and Xiangru Tang and Dragomir Radev and Alham Fikri Aji and Khalid Almubarak and Samuel Albanie and Zaid Alyafeai and Albert Webson and Edward Raff and Colin Raffel},
      year={2022},
      eprint={2211.01786},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}
```	

### Clone with HTTP
```bash
git clone https://www.modelscope.cn/AI-ModelScope/bloomz-7b1-mt.git
```
