File size: 1,647 Bytes
f178460 07fb958 f178460 07fb958 0509a1e 07fb958 0509a1e 07fb958 e0b4597 07fb958 e0b4597 0509a1e e0b4597 da2cd76 07fb958 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
---
license: other
language:
- en
- zh
library_name: transformers
pipeline_tag: text-generation
inference: false
tags:
- baichuan
- llama2
- baichuan2
---
This is the LLaMAfied version of [Baichuan2-7B-Chat](https://huggingface.co/baichuan-inc/Baichuan2-7B-Chat) model by Baichuan Inc.
This model is converted with https://github.com/hiyouga/LLaMA-Factory/blob/main/tests/llamafy_baichuan2.py
You may use this model for fine-tuning in downstream tasks, we recommend using our efficient fine-tuning toolkit. https://github.com/hiyouga/LLaMA-Factory
- **Developed by:** Baichuan Inc.
- **Language(s) (NLP):** Chinese/English
- **License:** [Baichuan2 License](https://huggingface.co/baichuan-inc/Baichuan2-7B-Chat/resolve/main/Baichuan2%20%E6%A8%A1%E5%9E%8B%E7%A4%BE%E5%8C%BA%E8%AE%B8%E5%8F%AF%E5%8D%8F%E8%AE%AE.pdf)
Usage:
```python
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
tokenizer = AutoTokenizer.from_pretrained("hiyouga/Baichuan2-7B-Chat-LLaMAfied", use_fast=False)
model = AutoModelForCausalLM.from_pretrained("hiyouga/Baichuan2-7B-Chat-LLaMAfied").cuda()
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
query = "<reserved_106>晚上睡不着怎么办<reserved_107>"
inputs = tokenizer([query], return_tensors="pt")
inputs = inputs.to("cuda")
generate_ids = model.generate(**inputs, max_new_tokens=256, streamer=streamer)
```
You could also alternatively launch a CLI demo by using the script in [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory)
```bash
python src/cli_demo.py --template baichuan2 --model_name_or_path hiyouga/Baichuan2-7B-Chat-LLaMAfied
```
|