Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
---
|
4 |
+
|
5 |
+
# ChiMed-GPT
|
6 |
+
|
7 |
+
ChiMed-GPT is a Chinese medical large language model (LLM) that is built by continually training [Ziya-v2](https://arxiv.org/abs/2311.03301) on Chinese medical data, where pre-training, supervised fine-tuning (SFT), and reinforcement learning from human feedback (RLHF) are performed.
|
8 |
+
|
9 |
+
More information about the model is coming soon.
|
10 |
+
|
11 |
+
## Citation
|
12 |
+
|
13 |
+
If you use or extend our work, please cite the following [paper]():
|
14 |
+
```
|
15 |
+
@article{USTC-ChiMed-GPT,
|
16 |
+
title="{ChiMed-GPT: A Chinese Medical Large Language Model with Full Training Regime and Better Alignment to Human Preferences}",
|
17 |
+
author={Yuanhe Tian, Ruyi Gan, Yan Song, Jiaxing Zhang, Yongdong Zhang},
|
18 |
+
journal={arXiv preprint arXiv:0000.00000},
|
19 |
+
year={2023},
|
20 |
+
}
|
21 |
+
```
|
22 |
+
|
23 |
+
## Usage
|
24 |
+
```python
|
25 |
+
from transformers import AutoTokenizer
|
26 |
+
from transformers import LlamaForCausalLM
|
27 |
+
import torch
|
28 |
+
|
29 |
+
query="[human]:感冒怎么处理?\n[bot]:"
|
30 |
+
model = LlamaForCausalLM.from_pretrained('SYNLP/ChiMed-GPT-1.0', torch_dtype=torch.float16, device_map="auto").eval()
|
31 |
+
tokenizer = AutoTokenizer.from_pretrained(ckpt)
|
32 |
+
input_ids = tokenizer(query, return_tensors="pt").input_ids.to('cuda:0')
|
33 |
+
generate_ids = model.generate(
|
34 |
+
input_ids,
|
35 |
+
max_new_tokens=512,
|
36 |
+
do_sample = True,
|
37 |
+
top_p = 0.9)
|
38 |
+
output = tokenizer.batch_decode(generate_ids)[0]
|
39 |
+
print(output)
|
40 |
+
```
|
41 |
+
|