Xtuner 大模型单卡低成本微调之本地实战--医学问答

本文介绍了如何使用Xtuner对大型语言模型进行低成本的单卡微调,聚焦于医学问答领域。首先,阐述了场景需求和数据预览,接着详细讲解了数据准备步骤,包括数据格式转换。然后,提到了配置文件的修改,尤其是引入deepspeed以加速训练。最后,展示了微调前后模型的对比,并提供了与合并后模型对话的实际操作指南,以及数据集来源。
摘要由CSDN通过智能技术生成

xtuner convert pth_to_hf internlm_chat_7b_qlora_medqa2019_e3.py ./work_dirs/internlm_chat_7b_qlora_medqa2019_e3/epoch_3.pth/mp_rank_00_model_states.pt ./任何使用xtuner可以查看这里

安装和使用

github 文末有

自定义微调

场景需求

基于 InternLM-chat-7B 模型,用 MedQA 数据集进行微调,将其往医学问答领域对齐。

真实数据预览

问题 答案
What are ketorolac eye drops?(什么是酮咯酸滴眼液?) Ophthalmic ketorolac is used to treat itchy eyes caused by allergies. It also is used to treat swelling and redness (inflammation) that can occur after cataract surgery. Ketorolac is in a class of medications called nonsteroidal anti-inflammatory drugs (NSAIDs). It works by stopping the release of substances that cause allergy symptoms and inflammation.
What medicines raise blood sugar? (什么药物会升高血糖?) Some medicines for conditions other than diabetes can raise your blood sugar level. This is a concern when you have diabetes. Make sure every doctor you see knows about all of the medicines, vitamins, or herbal supplements you take. This means anything you take with or without a prescription. Examples include: Barbiturates. Thiazide diuretics. Corticosteroids. Birth control pills (oral contraceptives) and progesterone. Catecholamines. Decongestants that contain beta-adrenergic agents, such as pseudoephedrine. The B vitamin niacin. The risk of high blood sugar from niacin lowers after you have taken it for a few months. The antipsychotic medicine olanzapine (Zyprexa).

数据准备

在这里插入图片描述

Medication QA 数据集为例

问题 药物类型 问题类型 回答 主题 URL
aaa bbb ccc ddd eee fff

将数据转为 XTuner 的数据格式
目标格式:(.jsonL)

[{
   
    "conversation":[
        {
   
            "system": "xxx",
            "input": "xxx",
            "output": "xxx"
        }
    ]
},
  • 31
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值