领域定制需完成以下四阶段操作:
- Data preparation phase::
- 收集专业数据并整理为
lora_medical.jsonl
specification - 建议保持512 token长度以适配模型架构
- 收集专业数据并整理为
- 参数配置阶段::
- modifications
./model/LMConfig.py
hit the nail on the headn_layers
等参数 - align
batch_size
避免显存溢出(3090建议≤8)
- modifications
- Model training phase::
- fulfillment
python train_lora.py
启动领域适应训练 - increase
--use_wandb
参数监控损失曲线
- fulfillment
- 部署应用阶段::
- utilization
serve_openai_api.py
Starting services - pass (a bill or inspection etc)
curl
命令测试医疗问答接口
- utilization
注意:专业领域训练建议先进行基础预训练(2-3轮)再进行LoRA微调。
This answer comes from the articleMiniMind: 2 hours from scratch training 26M parameters GPT open source toolsThe