Qwen大模型Lora微调-Windows

环境要求

  1. python 3.8 and above
  2. pytorch 1.12 and above, 2.0 and above are recommended
  3. transformers 4.32 and above
  4. CUDA 11.4 and above are recommended (this is for GPU users, flash-attention users, etc.)

微调步骤

1. 资源下载

Qwen:https://github.com/QwenLM/Qwen
qwen1_8B模型:https://modelscope.cn/models/Qwen/Qwen-1_8B-Chat
torch:https://download.pytorch.org/whl/torch_stable.html
flash-attention:https://github.com/Dao-AILab/flash-attention/releases/

2. 环境安装

conda create -n qwen python==3.10.1

# 安装torch
pip install "F:\llm\ptorch\torch-2.1.2+cu121-cp310-cp310-win_amd64.whl"

# 依赖
cd F:\github\Qwen
pip install -r requirements.txt

# 模型推理 web依赖包 图形化界面
pip install -r requirements_web_demo.txt

# 直接安装如果有问题,那就手动下载,本地安装
pip install "peft<0.8.0" deepspeed

# 非必须,模型加速,使用上面的连接下载到本地然后安装,手动编译我3个小时没编译完
pip install F:\llm\flash_attn-2.4.1+cu121torch2.1cxx11abiFALSE-cp310-cp310-win_amd64.whl

# 模型
git clone https://www.modelscope.cn/Qwen/Qwen-1_8B-Chat.git

3. 准备微调数据

看官网的微调格式:

[{
   
   "id":"identity_0","conversations":[{
   
   "from":"user","value":"你好"},{
   
   "from":"assistant","value":"我是一个语言模型,我叫通义千问。"}]}]

准备数据如下:
DISC-Law-SFT-Triplet-released-Qwen.json

4. 修改微调参数

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值