petkopetkov lbourdois commited on
Commit
070f3d9
·
verified ·
1 Parent(s): 71eb6d8

Improve language tag (#1)

Browse files

- Improve language tag (6bd30382c264232472841d2bb90b16f4cb886a22)


Co-authored-by: Loïck BOURDOIS <[email protected]>

Files changed (1) hide show
  1. README.md +67 -53
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
- 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.
11
-
12
- ### Usage
13
-
14
- First, install the Transformers library with:
15
- ```sh
16
- pip install -U transformers
17
- ```
18
-
19
- #### Run with the `pipeline` API
20
-
21
- ```python
22
- from transformers import pipeline
23
- import torch
24
-
25
- system_prompt = (
26
- "You are a medical assistant trained to provide general health information. "
27
- "Follow these rules:\n"
28
- "1. Only answer the question asked.\n"
29
- "2. Do not provide any additional stories, anecdotes, or personal information.\n"
30
- "3. Do not deviate from medical facts.\n"
31
- "5. Do not include references/sources (papers, websites, etc.)\n"
32
- "6. Be concise and accurate.\n\n"
33
- ""
34
- )
35
-
36
- 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?"
37
-
38
- chat = [
39
- {"role": "system", "content": system_prompt},
40
- {"role": "user", "content": prompt},
41
- ]
42
-
43
- pipe = pipeline(
44
- task="text-generation",
45
- model="petkopetkov/Qwen2.5-0.5B-Instruct-med-diagnosis",
46
- torch_dtype=torch.bfloat16,
47
- device_map="auto",
48
- max_new_tokens=1024,
49
- )
50
-
51
- response = pipe(chat)
52
-
53
- print(response[0]["generated_text"][0])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
  ```