Improve language tag (#1)
Browse files- Improve language tag (6bd30382c264232472841d2bb90b16f4cb886a22)
Co-authored-by: Loïck BOURDOIS <[email protected]>
README.md
CHANGED
@@ -1,54 +1,68 @@
|
|
1 |
-
---
|
2 |
-
library_name: transformers
|
3 |
-
license: apache-2.0
|
4 |
-
datasets:
|
5 |
-
- petkopetkov/medical-question-answering-synthetic
|
6 |
-
base_model:
|
7 |
-
- Qwen/Qwen2.5-0.5B-Instruct
|
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 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
```
|
|
|
1 |
+
---
|
2 |
+
library_name: transformers
|
3 |
+
license: apache-2.0
|
4 |
+
datasets:
|
5 |
+
- petkopetkov/medical-question-answering-synthetic
|
6 |
+
base_model:
|
7 |
+
- Qwen/Qwen2.5-0.5B-Instruct
|
8 |
+
language:
|
9 |
+
- zho
|
10 |
+
- eng
|
11 |
+
- fra
|
12 |
+
- spa
|
13 |
+
- por
|
14 |
+
- deu
|
15 |
+
- ita
|
16 |
+
- rus
|
17 |
+
- jpn
|
18 |
+
- kor
|
19 |
+
- vie
|
20 |
+
- tha
|
21 |
+
- ara
|
22 |
+
---
|
23 |
+
|
24 |
+
This model is a fintuned Qwen2.5-0.5B-Instruct on a custom preprocessed dataset (petkopetkov/medical-question-answering-synthetic). It was evaluated using qualitative ranking and achieves better results than the base model.
|
25 |
+
|
26 |
+
### Usage
|
27 |
+
|
28 |
+
First, install the Transformers library with:
|
29 |
+
```sh
|
30 |
+
pip install -U transformers
|
31 |
+
```
|
32 |
+
|
33 |
+
#### Run with the `pipeline` API
|
34 |
+
|
35 |
+
```python
|
36 |
+
from transformers import pipeline
|
37 |
+
import torch
|
38 |
+
|
39 |
+
system_prompt = (
|
40 |
+
"You are a medical assistant trained to provide general health information. "
|
41 |
+
"Follow these rules:\n"
|
42 |
+
"1. Only answer the question asked.\n"
|
43 |
+
"2. Do not provide any additional stories, anecdotes, or personal information.\n"
|
44 |
+
"3. Do not deviate from medical facts.\n"
|
45 |
+
"5. Do not include references/sources (papers, websites, etc.)\n"
|
46 |
+
"6. Be concise and accurate.\n\n"
|
47 |
+
""
|
48 |
+
)
|
49 |
+
|
50 |
+
prompt = "What is contact dermatitis, and what are some of the typical symptoms associated with this condition, including the type of hypersensitivity reaction that causes it?"
|
51 |
+
|
52 |
+
chat = [
|
53 |
+
{"role": "system", "content": system_prompt},
|
54 |
+
{"role": "user", "content": prompt},
|
55 |
+
]
|
56 |
+
|
57 |
+
pipe = pipeline(
|
58 |
+
task="text-generation",
|
59 |
+
model="petkopetkov/Qwen2.5-0.5B-Instruct-med-diagnosis",
|
60 |
+
torch_dtype=torch.bfloat16,
|
61 |
+
device_map="auto",
|
62 |
+
max_new_tokens=1024,
|
63 |
+
)
|
64 |
+
|
65 |
+
response = pipe(chat)
|
66 |
+
|
67 |
+
print(response[0]["generated_text"][0])
|
68 |
```
|