Llama3-Tutorial/docs/llava.md at main · SmartFlowAI/Llama3-Tutorial (github.com) 参考机智流官方教程 先激活环境,这些都是之前的学习内容
conda activate llama3
cd ~
git clone https://github.com/SmartFlowAI/Llama3-Tutorial
cd XTuner
pip install -e .
自我认知训练数据集准备
把机智流的英文改为中文
conda activate llama3
python tools/gdata.py
激活环境,运行脚本
cd ~/Llama3-Tutorial
xtuner train configs/assistant/llama3_8b_instruct_qlora_assistant.py --work-dir /root/llama3_pth
xtuner convert pth_to_hf /root/llama3_pth/llama3_8b_instruct_qlora_assistant.py \
/root/llama3_pth/iter_500.pth \
/root/llama3_hf_adapter
# Adapter PTH 转 HF 格式
xtuner convert pth_to_hf /root/llama3_pth/llama3_8b_instruct_qlora_assistant.py \
/root/llama3_pth/iter_500.pth \
/root/llama3_hf_adapter
# 模型合并
export MKL_SERVICE_FORCE_INTEL=1
xtuner convert merge /root/model/Meta-Llama-3-8B-Instruct \
/root/llama3_hf_adapter\
/root/llama3_hf_merged
推理验证
streamlit run ~/Llama3-Tutorial/tools/internstudio_web_demo.py \
/root/llama3_hf_merged
微调完只会说一句话了【捂脸】