unsloth單卡4090微調DeepSeek-R1-Distill-Qwen-14B醫學領域后,跑通一下多卡微調。
1,準備2卡RTX 4090
2,準備數據集
醫學領域
pip install -U huggingface_hub
export HF_ENDPOINT=https://hf-mirror.com
huggingface-cli download --resume-download --repo-type dataset FreedomIntelligence/medical-o1-reasoning-SFT --local-dir FreedomIntelligence/medical-o1-reasoning-SFT?
3,安裝LLaMA-Factory 和下載模型
需要提前搭建好docker微調環境
下載模型 ,需要是 safetensors 權重文件
git clone --depth 1 https://github.com/hiyouga/LLaMA-Factory.git
cd LLaMA-Factory
pip install -e ".[torch,metrics]"
llamafactory-cli webui
# llamafactory-cli version
INFO 04-12 04:48:24 __init__.py:190] Automatically detected platform cuda.
----------------------------------------------------------
| Welcome to LLaMA Factory, version 0.9.3.dev0 |
| |
| Project page: https://github.com/hiyouga/LLaMA-Factory |
----------------------------------------------------------
/workspace# python toShareGPT.py 轉換數據集
4,注冊數據集
cp /datasets/medical_sharegpt_format.json ./LLaMA-Factory/data/
修改 `data/dataset_info.json`,添加自定義數據集:
"medical_sharegpt_format": {
"file_name": "medical_sharegpt_format.json",
"formatting": "sharegpt",
"columns": {
"messages": "conversations",
"system": "system"
}
}