书生大模型实战营第4期 基础岛 第5关 L1G5000 XTuner 微调个人小助手认 知

XTuner 微调个人小助手认知

基础任务 使用 XTuner 微调 InternLM2-Chat-7B 实现自己的小助手认知

创建python虚拟环境并安装xtuner

xtuner list-cfg

在这里插入图片描述

构造微调数据

更改jsonl文件,把其中的“机智流”替换为自己的名字

python change_script.py ./assistant_Tuner.jsonl ./assistant_Tuner_change.jsonl

在这里插入图片描述

微调模型

xtuner train ./config/internlm2_5_chat_7b_qlora_alpaca_e3_copy.py \
--deepspeed deepspeed_zero2 \
--work-dir ./work_dirs/assistTuner

在这里插入图片描述

获得.bin后缀的lora adapter:

MKL_SERVICE_FORCE_INTEL=1 MKL_THREADING_LAYER=GNU xtuner convert pth_to_hf ./internlm2_5_chat_7b_qlora_alpaca_e3_copy.py ./iter_289.pth ./hf

在这里插入图片描述
合并adapter得到完整模型权重:

MKL_SERVICE_FORCE_INTEL=1 MKL_THREADING_LAYER=GNU xtuner convert merge /root/finetune/models/internlm2_5-7b-chat ./hf ./merged --max-shard-size 4GB

在这里插入图片描述
在这里插入图片描述

启动 Web-UI

streamlit run app.py
Collecting usage statistics. To deactivate, set browser.gatherUsageStats to false.


  You can now view your Streamlit app in your browser.

  Local URL: http://localhost:8501
  Network URL: http://xxx:8501
  External URL: http://yyy:8501

打开浏览器,访问映射后的地址
然后输入以下问题,可以看到模型是按照微调数据集中的数据来做回答的:
在这里插入图片描述
任务完成!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值