fireinwind
commited on
Commit
•
9b2de9d
1
Parent(s):
759a641
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,50 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
+
language:
|
5 |
+
- zh
|
6 |
+
- en
|
7 |
+
library_name: transformers
|
8 |
+
tags:
|
9 |
+
- baichuan
|
10 |
+
---
|
11 |
+
|
12 |
+
This is an SFT model trained using https://github.com/hiyouga/LLaMA-Efficient-Tuning.
|
13 |
+
|
14 |
+
Thanks to the original author for their hard work.
|
15 |
+
|
16 |
+
All work is based on https://huggingface.co/baichuan-inc/baichuan-7B.
|
17 |
+
|
18 |
+
You can find the matching data set on the github of the fine-tuning framework.
|
19 |
+
|
20 |
+
We carried out 4 epoch of distributed training on the 8-card H100 machine, which took a short time. However, there is not much change in the loss.
|
21 |
+
In the future, we will update the data set to see how it will perform in a vertical field.
|
22 |
+
|
23 |
+
Of course, this is the inference code of the original author. You can use it directly.
|
24 |
+
|
25 |
+
Usage:
|
26 |
+
|
27 |
+
```python
|
28 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
|
29 |
+
from peft import PeftModel
|
30 |
+
|
31 |
+
|
32 |
+
tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/baichuan-7B", trust_remote_code=True)
|
33 |
+
model = AutoModelForCausalLM.from_pretrained("baichuan-inc/baichuan-7B", device_map="auto", trust_remote_code=True)
|
34 |
+
model = PeftModel.from_pretrained(model, "/data/baichuan-7b-sft") #change to your own path.
|
35 |
+
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
|
36 |
+
|
37 |
+
query = "晚上睡不着怎么办"
|
38 |
+
|
39 |
+
inputs = tokenizer(["<human>:{}\n<bot>:".format(query)], return_tensors="pt")
|
40 |
+
inputs = inputs.to("cuda")
|
41 |
+
generate_ids = model.generate(**inputs, max_new_tokens=256, streamer=streamer)
|
42 |
+
```
|
43 |
+
|
44 |
+
You could also alternatively launch a CLI demo by using the script in https://github.com/hiyouga/LLaMA-Efficient-Tuning
|
45 |
+
```bash
|
46 |
+
python src/cli_demo.py \
|
47 |
+
--model_name_or_path baichuan-inc/baichuan-7B \
|
48 |
+
--checkpoint_dir hiyouga/baichuan-7b-sft \
|
49 |
+
|
50 |
+
```
|