ggbaobao lbourdois commited on
Commit
6a5c7cf
·
verified ·
1 Parent(s): 7985e45

Improve language tag (#1)

Browse files

- Improve language tag (f62d13f6a9c0c132ca3c61260309e4a398264e0c)


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

Files changed (1) hide show
  1. README.md +100 -88
README.md CHANGED
@@ -1,88 +1,100 @@
1
- ---
2
- license: mit
3
- language:
4
- - zh
5
- base_model:
6
- - Qwen/Qwen2.5-7B-Instruct
7
- tags:
8
- - medical
9
- ---
10
-
11
- ## Model Details
12
- This model has been LoRA‑fine‑tuned on Qwen2.5‑7B‑Instruct.
13
- In the future, reinforcement learning training may be carried out based on this model, such as DPRO algorithm, etc.
14
-
15
-
16
- ### Base Model Sources [optional]
17
-
18
- https://huggingface.co/Qwen/Qwen2.5-7B-Instruct
19
-
20
- ## How to Get Started with the Model
21
- ```python
22
- from transformers import AutoModelForCausalLM, AutoTokenizer
23
- model_name = "ggbaobao/medc_llm_based_on_qwen2.5"
24
- model = AutoModelForCausalLM.from_pretrained(
25
- model_name,
26
- device_map="auto",
27
- torch_dtype=torch.bfloat16
28
- )
29
- tokenizer = AutoTokenizer.from_pretrained(model_name)
30
- prompt = "猩红热多在发热后多久出现皮疹,请从以下选项中选择:12小时之内, 12~48小时, 60~72小时, 84~96小时, 大于96小时"
31
- messages = [
32
- {"role": "system", "content": "You are Qwen, You are a helpful assistant."},
33
- {"role": "user", "content": prompt},
34
- ]
35
- text = tokenizer.apply_chat_template(
36
- messages,
37
- tokenize=False,
38
- add_generation_prompt=True
39
- )
40
- model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
41
-
42
- generated_ids = model.generate(
43
- **model_inputs,
44
- max_new_tokens=512,
45
- do_sample=True
46
- )
47
- generated_ids = [output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)]
48
- response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
49
-
50
- print(response)
51
- ```
52
- ## Training Details
53
- ```python
54
- lora_config = LoraConfig(
55
- r=16,
56
- lora_alpha=32,
57
- target_modules=["q_proj", "v_proj"],
58
- lora_dropout=0.1
59
- )
60
-
61
- training_args = TrainingArguments(
62
- output_dir="./results_final1",
63
- learning_rate=7e-5,
64
- per_device_train_batch_size=2,
65
- per_device_eval_batch_size=2,
66
- gradient_accumulation_steps=1, # 梯度累积
67
- num_train_epochs=2,
68
- evaluation_strategy="steps",
69
- # evaluate_steps=1,
70
- save_strategy="steps",
71
- save_steps=10,
72
- logging_steps=10,
73
- logging_dir="./logs1",
74
- bf16=True, # 混合精度训练
75
- ```
76
- ### Training Data
77
-
78
- The training data comes from https://github.com/SupritYoung/Zhongjing
79
- If you want to know more details about the above github project, you can also read their paper:
80
- Zhongjing: Enhancing the Chinese Medical Capabilities of Large Language Model through Expert Feedback and Real-world Multi-turn Dialogue
81
-
82
- The data includes about one-seventh of the multi-round medical consultation data and six-sevenths of the single medical consultation data.
83
-
84
- #### Hardware
85
- vGPU-32GB * 6
86
-
87
- #### Software
88
- use peft and deepspeed
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - zho
5
+ - eng
6
+ - fra
7
+ - spa
8
+ - por
9
+ - deu
10
+ - ita
11
+ - rus
12
+ - jpn
13
+ - kor
14
+ - vie
15
+ - tha
16
+ - ara
17
+ base_model:
18
+ - Qwen/Qwen2.5-7B-Instruct
19
+ tags:
20
+ - medical
21
+ ---
22
+
23
+ ## Model Details
24
+ This model has been LoRA‑fine‑tuned on Qwen2.5‑7B‑Instruct.
25
+ In the future, reinforcement learning training may be carried out based on this model, such as DPRO algorithm, etc.
26
+
27
+
28
+ ### Base Model Sources [optional]
29
+
30
+ https://huggingface.co/Qwen/Qwen2.5-7B-Instruct
31
+
32
+ ## How to Get Started with the Model
33
+ ```python
34
+ from transformers import AutoModelForCausalLM, AutoTokenizer
35
+ model_name = "ggbaobao/medc_llm_based_on_qwen2.5"
36
+ model = AutoModelForCausalLM.from_pretrained(
37
+ model_name,
38
+ device_map="auto",
39
+ torch_dtype=torch.bfloat16
40
+ )
41
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
42
+ prompt = "猩红热多在发热后多久出现皮疹,请从以下选项中选择:12小时之内, 12~48小时, 60~72小时, 84~96小时, 大于96小时"
43
+ messages = [
44
+ {"role": "system", "content": "You are Qwen, You are a helpful assistant."},
45
+ {"role": "user", "content": prompt},
46
+ ]
47
+ text = tokenizer.apply_chat_template(
48
+ messages,
49
+ tokenize=False,
50
+ add_generation_prompt=True
51
+ )
52
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
53
+
54
+ generated_ids = model.generate(
55
+ **model_inputs,
56
+ max_new_tokens=512,
57
+ do_sample=True
58
+ )
59
+ generated_ids = [output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)]
60
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
61
+
62
+ print(response)
63
+ ```
64
+ ## Training Details
65
+ ```python
66
+ lora_config = LoraConfig(
67
+ r=16,
68
+ lora_alpha=32,
69
+ target_modules=["q_proj", "v_proj"],
70
+ lora_dropout=0.1
71
+ )
72
+
73
+ training_args = TrainingArguments(
74
+ output_dir="./results_final1",
75
+ learning_rate=7e-5,
76
+ per_device_train_batch_size=2,
77
+ per_device_eval_batch_size=2,
78
+ gradient_accumulation_steps=1, # 梯度累积
79
+ num_train_epochs=2,
80
+ evaluation_strategy="steps",
81
+ # evaluate_steps=1,
82
+ save_strategy="steps",
83
+ save_steps=10,
84
+ logging_steps=10,
85
+ logging_dir="./logs1",
86
+ bf16=True, # 混合精度训练
87
+ ```
88
+ ### Training Data
89
+
90
+ The training data comes from https://github.com/SupritYoung/Zhongjing
91
+ If you want to know more details about the above github project, you can also read their paper:
92
+ Zhongjing: Enhancing the Chinese Medical Capabilities of Large Language Model through Expert Feedback and Real-world Multi-turn Dialogue
93
+
94
+ The data includes about one-seventh of the multi-round medical consultation data and six-sevenths of the single medical consultation data.
95
+
96
+ #### Hardware
97
+ vGPU-32GB * 6
98
+
99
+ #### Software
100
+ use peft and deepspeed