|
--- |
|
language: |
|
- en |
|
- zh |
|
pipeline_tag: text-generation |
|
--- |
|
## chatbloom-7b |
|
|
|
This is a RLHF enhanced bloom model (chatbloom), fine-tuned based on bloom-7b (Muennighoff et al.). This model only uses English QA datasets for RLHF training, which improves the understanding and generation of English. |
|
|
|
### Usage |
|
|
|
If you don't have a good GPU (mem > 20G) then use the code below: |
|
|
|
```python |
|
# pip install -q transformers accelerate |
|
from transformers import AutoModelForCausalLM, AutoTokenizer |
|
|
|
checkpoint = "hongyin/chatbloom-7b" |
|
|
|
tokenizer = AutoTokenizer.from_pretrained(checkpoint) |
|
model = AutoModelForCausalLM.from_pretrained(checkpoint) |
|
|
|
inputs = tokenizer.encode("Paraphrasing the text: I love you.", return_tensors="pt") |
|
outputs = model.generate(inputs) |
|
print(tokenizer.decode(outputs[0])) |
|
|
|
Original ouput: Paraphrasing the text: I love you. I love you. I love you. I love |
|
ChatBloom ouput: Paraphrasing the text: I love you. I am a good person. |
|
``` |
|
|
|
If you have a good GPU (mem > 20G) then use the code below: |
|
|
|
```python |
|
# pip install -q transformers accelerate |
|
from transformers import AutoModelForCausalLM, AutoTokenizer |
|
|
|
checkpoint = "hongyin/chatbloom-7b" |
|
|
|
tokenizer = AutoTokenizer.from_pretrained(checkpoint) |
|
model = AutoModelForCausalLM.from_pretrained(checkpoint, torch_dtype="auto", device_map="auto") |
|
|
|
inputs = tokenizer.encode("Paraphrasing the text: I love you.", return_tensors="pt").to("cuda") |
|
outputs = model.generate(inputs) |
|
print(tokenizer.decode(outputs[0])) |
|
|
|
Original ouput: Paraphrasing the text: I love you. I love you. I love you. I love |
|
ChatBloom ouput: Paraphrasing the text: I love you. I am a good person. |
|
``` |
|
|
|
## Bibtex entry and citation info |
|
Please cite if you find it helpful. |
|
``` |
|
@article{zhu2023metaaid, |
|
title={MetaAID 2.0: An Extensible Framework for Developing Metaverse Applications via Human-controllable Pre-trained Models}, |
|
author={Zhu, Hongyin}, |
|
journal={arXiv preprint arXiv:2302.13173}, |
|
year={2023} |
|
} |
|
|
|
``` |
|
|
|
--- |
|
license: other |
|
--- |