Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,41 @@
|
|
1 |
---
|
2 |
license: llama2
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: llama2
|
3 |
+
datasets:
|
4 |
+
- tatsu-lab/alpaca
|
5 |
+
- OpenAssistant/oasst1
|
6 |
+
pipeline_tag: text-generation
|
7 |
---
|
8 |
+
|
9 |
+
A bilingual instruction-tuned LoRA model of https://huggingface.co/meta-llama/Llama-2-13b-hf
|
10 |
+
|
11 |
+
- Instruction-following datasets used: alpaca, alpaca-zh, openassistant
|
12 |
+
- Training framework: https://github.com/hiyouga/LLaMA-Efficient-Tuning
|
13 |
+
|
14 |
+
Usage:
|
15 |
+
|
16 |
+
```python
|
17 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
|
18 |
+
|
19 |
+
tokenizer = AutoTokenizer.from_pretrained("hiyouga/Llama-2-Chinese-13b-chat")
|
20 |
+
model = AutoModelForCausalLM.from_pretrained("hiyouga/Llama-2-Chinese-13b-chat").cuda()
|
21 |
+
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
|
22 |
+
|
23 |
+
query = "晚上睡不着怎么办"
|
24 |
+
template = (
|
25 |
+
"A chat between a curious user and an artificial intelligence assistant. "
|
26 |
+
"The assistant gives helpful, detailed, and polite answers to the user's questions.\n"
|
27 |
+
"Human: {}\nAssistant: "
|
28 |
+
)
|
29 |
+
|
30 |
+
inputs = tokenizer([template.format(query)], return_tensors="pt")
|
31 |
+
inputs = inputs.to("cuda")
|
32 |
+
generate_ids = model.generate(**inputs, max_new_tokens=256, streamer=streamer)
|
33 |
+
```
|
34 |
+
|
35 |
+
You could also alternatively launch a CLI demo by using the script in https://github.com/hiyouga/LLaMA-Efficient-Tuning
|
36 |
+
|
37 |
+
```bash
|
38 |
+
python src/cli_demo.py --model_name_or_path hiyouga/Llama-2-Chinese-13b-chat
|
39 |
+
```
|
40 |
+
|
41 |
+
---
|