Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -1,210 +1,122 @@
|
|
1 |
---
|
2 |
-
|
3 |
-
|
4 |
-
|
|
|
5 |
tags:
|
6 |
-
-
|
|
|
|
|
|
|
7 |
- lora
|
8 |
-
- sft
|
9 |
-
- transformers
|
10 |
-
- trl
|
11 |
- unsloth
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
---
|
13 |
|
14 |
-
#
|
15 |
-
|
16 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
## Model Details
|
21 |
-
|
22 |
-
### Model Description
|
23 |
-
|
24 |
-
<!-- Provide a longer summary of what this model is. -->
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
- **Developed by:** [More Information Needed]
|
29 |
-
- **Funded by [optional]:** [More Information Needed]
|
30 |
-
- **Shared by [optional]:** [More Information Needed]
|
31 |
-
- **Model type:** [More Information Needed]
|
32 |
-
- **Language(s) (NLP):** [More Information Needed]
|
33 |
-
- **License:** [More Information Needed]
|
34 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
35 |
-
|
36 |
-
### Model Sources [optional]
|
37 |
-
|
38 |
-
<!-- Provide the basic links for the model. -->
|
39 |
-
|
40 |
-
- **Repository:** [More Information Needed]
|
41 |
-
- **Paper [optional]:** [More Information Needed]
|
42 |
-
- **Demo [optional]:** [More Information Needed]
|
43 |
-
|
44 |
-
## Uses
|
45 |
-
|
46 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
47 |
-
|
48 |
-
### Direct Use
|
49 |
-
|
50 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
51 |
-
|
52 |
-
[More Information Needed]
|
53 |
-
|
54 |
-
### Downstream Use [optional]
|
55 |
-
|
56 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
57 |
-
|
58 |
-
[More Information Needed]
|
59 |
-
|
60 |
-
### Out-of-Scope Use
|
61 |
-
|
62 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
63 |
-
|
64 |
-
[More Information Needed]
|
65 |
-
|
66 |
-
## Bias, Risks, and Limitations
|
67 |
-
|
68 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
69 |
-
|
70 |
-
[More Information Needed]
|
71 |
-
|
72 |
-
### Recommendations
|
73 |
-
|
74 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
75 |
-
|
76 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
77 |
-
|
78 |
-
## How to Get Started with the Model
|
79 |
-
|
80 |
-
Use the code below to get started with the model.
|
81 |
-
|
82 |
-
[More Information Needed]
|
83 |
-
|
84 |
-
## Training Details
|
85 |
-
|
86 |
-
### Training Data
|
87 |
-
|
88 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
89 |
-
|
90 |
-
[More Information Needed]
|
91 |
-
|
92 |
-
### Training Procedure
|
93 |
-
|
94 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
95 |
-
|
96 |
-
#### Preprocessing [optional]
|
97 |
-
|
98 |
-
[More Information Needed]
|
99 |
-
|
100 |
-
|
101 |
-
#### Training Hyperparameters
|
102 |
-
|
103 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
104 |
-
|
105 |
-
#### Speeds, Sizes, Times [optional]
|
106 |
-
|
107 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
108 |
-
|
109 |
-
[More Information Needed]
|
110 |
-
|
111 |
-
## Evaluation
|
112 |
-
|
113 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
114 |
-
|
115 |
-
### Testing Data, Factors & Metrics
|
116 |
-
|
117 |
-
#### Testing Data
|
118 |
-
|
119 |
-
<!-- This should link to a Dataset Card if possible. -->
|
120 |
-
|
121 |
-
[More Information Needed]
|
122 |
-
|
123 |
-
#### Factors
|
124 |
-
|
125 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
126 |
-
|
127 |
-
[More Information Needed]
|
128 |
-
|
129 |
-
#### Metrics
|
130 |
-
|
131 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
132 |
-
|
133 |
-
[More Information Needed]
|
134 |
-
|
135 |
-
### Results
|
136 |
-
|
137 |
-
[More Information Needed]
|
138 |
-
|
139 |
-
#### Summary
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
## Model Examination [optional]
|
144 |
-
|
145 |
-
<!-- Relevant interpretability work for the model goes here -->
|
146 |
-
|
147 |
-
[More Information Needed]
|
148 |
-
|
149 |
-
## Environmental Impact
|
150 |
|
151 |
-
|
152 |
|
153 |
-
|
154 |
|
155 |
-
|
156 |
-
- **Hours used:** [More Information Needed]
|
157 |
-
- **Cloud Provider:** [More Information Needed]
|
158 |
-
- **Compute Region:** [More Information Needed]
|
159 |
-
- **Carbon Emitted:** [More Information Needed]
|
160 |
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
162 |
|
163 |
-
|
164 |
|
165 |
-
|
|
|
|
|
|
|
|
|
166 |
|
167 |
-
|
168 |
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
-
|
172 |
|
173 |
-
|
|
|
174 |
|
175 |
-
|
|
|
|
|
|
|
|
|
|
|
176 |
|
177 |
-
|
|
|
|
|
178 |
|
179 |
-
|
|
|
|
|
|
|
|
|
|
|
180 |
|
181 |
-
|
|
|
|
|
182 |
|
183 |
-
|
184 |
|
185 |
-
|
|
|
|
|
|
|
|
|
186 |
|
187 |
-
|
188 |
|
189 |
-
|
|
|
|
|
|
|
|
|
190 |
|
191 |
-
##
|
192 |
|
193 |
-
|
|
|
|
|
|
|
|
|
194 |
|
195 |
-
|
196 |
|
197 |
-
|
|
|
|
|
|
|
198 |
|
199 |
-
|
200 |
|
201 |
-
|
202 |
|
203 |
-
|
204 |
|
205 |
-
|
206 |
|
207 |
-
|
208 |
-
### Framework versions
|
209 |
|
210 |
-
-
|
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- zh
|
4 |
+
license: apache-2.0
|
5 |
+
library_name: transformers
|
6 |
tags:
|
7 |
+
- medical
|
8 |
+
- chinese
|
9 |
+
- qa
|
10 |
+
- gemma3n
|
11 |
- lora
|
|
|
|
|
|
|
12 |
- unsloth
|
13 |
+
base_model: unsloth/gemma-3n-E4B-it
|
14 |
+
datasets:
|
15 |
+
- FreedomIntelligence/huatuo_encyclopedia_qa
|
16 |
+
- FreedomIntelligence/medical-o1-reasoning-SFT
|
17 |
+
- FreedomIntelligence/huatuo_knowledge_graph_qa
|
18 |
+
pipeline_tag: text-generation
|
19 |
---
|
20 |
|
21 |
+
# MedGemma3N-chinese-qa-v1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
+
## 模型简介
|
24 |
|
25 |
+
MedGemma3N-chinese-qa-v1 是基于 Gemma3N-4B 架构的中文医学问答模型第一阶段版本,专门针对中文医学领域进行了微调优化。
|
26 |
|
27 |
+
## 模型特点
|
|
|
|
|
|
|
|
|
28 |
|
29 |
+
- **版本**: v1 (第一阶段基础版本)
|
30 |
+
- **基础架构**: Gemma3N-4B + LoRA微调
|
31 |
+
- **训练数据**: 13,153条高质量中文医学问答数据
|
32 |
+
- **数据扩展**: 相比原始数据增长4.7倍
|
33 |
+
- **专业领域**: 涵盖疾病诊断、治疗建议、药物咨询等
|
34 |
+
- **后续计划**: 将基于85,000条专业临床数据进行第二阶段增强
|
35 |
|
36 |
+
## 训练数据来源
|
37 |
|
38 |
+
| 数据源 | 数量 | 占比 | 描述 |
|
39 |
+
|--------|------|------|------|
|
40 |
+
| 华佗百科问答 | 7,960条 | 60.5% | 复旦大学华佗医学百科问答数据集 |
|
41 |
+
| 医疗推理数据 | 2,924条 | 22.2% | FreedomIntelligence医学O1推理数据 |
|
42 |
+
| 华佗知识图谱 | 2,269条 | 17.3% | 结构化医学知识问答数据 |
|
43 |
|
44 |
+
## 训练配置
|
45 |
|
46 |
+
- **基础模型**: unsloth/gemma-3n-E4B-it
|
47 |
+
- **微调方法**: LoRA (rank=16, alpha=32)
|
48 |
+
- **训练步数**: 8,000步
|
49 |
+
- **学习率**: 2e-4
|
50 |
+
- **批次大小**: 4 (1×4梯度累积)
|
51 |
+
- **优化器**: adamw_8bit
|
52 |
|
53 |
+
## 使用方法
|
54 |
|
55 |
+
```python
|
56 |
+
from unsloth import FastModel
|
57 |
|
58 |
+
# 加载模型
|
59 |
+
model, tokenizer = FastModel.from_pretrained(
|
60 |
+
"ZhangQiao123/MedGemma3N-chinese-qa-v1",
|
61 |
+
dtype=None,
|
62 |
+
load_in_4bit=True
|
63 |
+
)
|
64 |
|
65 |
+
# 生成回答
|
66 |
+
messages = [{"role": "user", "content": "什么是高血压?"}]
|
67 |
+
inputs = tokenizer.apply_chat_template(messages, tokenize=True, return_tensors="pt")
|
68 |
|
69 |
+
outputs = model.generate(
|
70 |
+
inputs,
|
71 |
+
max_new_tokens=512,
|
72 |
+
temperature=0.7,
|
73 |
+
do_sample=True
|
74 |
+
)
|
75 |
|
76 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
77 |
+
print(response)
|
78 |
+
```
|
79 |
|
80 |
+
## 应用场景
|
81 |
|
82 |
+
- 中文医学问答
|
83 |
+
- 疾病症状咨询
|
84 |
+
- 治疗建议提供
|
85 |
+
- 药物使用指导
|
86 |
+
- 医学知识解释
|
87 |
|
88 |
+
## 模型性能
|
89 |
|
90 |
+
该模型在以下方面表现优秀:
|
91 |
+
- ✅ 医学术语理解准确
|
92 |
+
- ✅ 疾病诊断推理合理
|
93 |
+
- ✅ 治疗建议专业可靠
|
94 |
+
- ✅ 中文医学表达流畅
|
95 |
|
96 |
+
## 注意事项
|
97 |
|
98 |
+
⚠️ **重要提醒**:
|
99 |
+
- 本模型仅供学习研究使用
|
100 |
+
- 不能替代专业医生诊断
|
101 |
+
- 实际医疗决策请咨询专业医生
|
102 |
+
- 模型回答仅供参考
|
103 |
|
104 |
+
## 技术细节
|
105 |
|
106 |
+
- **模型大小**: ~4B参数 + LoRA适配器
|
107 |
+
- **推理速度**: 支持4位量化快速推理
|
108 |
+
- **内存需求**: 约8-12GB GPU内存
|
109 |
+
- **支持框架**: Transformers, Unsloth
|
110 |
|
111 |
+
## 开发团队
|
112 |
|
113 |
+
基于Unsloth框架和FreedomIntelligence数据集开发
|
114 |
|
115 |
+
## 许可证
|
116 |
|
117 |
+
Apache 2.0
|
118 |
|
119 |
+
## 更新日志
|
|
|
120 |
|
121 |
+
- **v1.0** (2025-01-25): 第一阶段基础版本发布,基于13,153条中文医学数据训练
|
122 |
+
- **计划v2.0**: 第二阶段专业增强版本,将基于85,000条专业临床数据进行训练
|