ssbuild / baichuan2_finetuning

baichuan-13b finetuning and alpaca finetuning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

update information

    08-02 增加 muti lora infer 例子, 手动升级 aigc_zoo , pip install -U git+https://github.com/ssbuild/aigc_zoo.git --force-reinstall --no-deps 
    07-11 support baichuan2 finetuning

install

  • pip install -U -r requirements.txt
  • 如果无法安装, 可以切换官方源 pip install -i https://pypi.org/simple -U -r requirements.txt
dev 通过一下方式安装 , 注意顺序
pip uninstall aigc_zoo
pip install -U git+https://github.com/ssbuild/aigc_zoo#egg=aigc_zoo

weigtht select one is suitable for you

data sample

open data https://github.com/ssbuild/open_data

单条数据示例

p prefix  optional
q question optional
a answer   must

 {
    "id": 0, 
    "p": "我是qwen训练的模型",
    "paragraph": [
        {
           "q": "你好",
           "a": "我是机器人,有什么可以帮助你的?"
        },
         {
             "q": "从南京到上海的路线",
             "a":  "你好,南京到上海的路线如下:1. 南京到上海,可以乘坐南京地铁1号线,在南京站乘坐轨道交通1号线。2. 南京到浦东机场,可以搭乘上海地铁1号,在陆家嘴站乘坐地铁1线,在浦东国际机场站乘坐机场快线,前往上海浦东国际机场。3. 上海到南京,可以换乘上海地铁2号线,从南京站换乘地铁2线,再从南京南站换乘地铁1路,然后到达上海站"
         }
     ]
 }

或者

 {
    "id": 0,
    "conversations": [
      {
        "from": "system",
        "value": "我是qwen训练的模型"
      },
      {
        "from": "user",
        "value": "你好"
      },
      {
        "from": "assistant",
        "value": "我是机器人,有什么可以帮助你的?"
      },
      {
        "from": "user",
        "value": "从南京到上海的路线"
      },
      {
        "from": "assistant",
        "value": "你好,南京到上海的路线如下:1. 南京到上海,可以乘坐南京地铁1号线,在南京站乘坐轨道交通1号线。2. 南京到浦东机场,可以搭乘上海地铁1号,在陆家嘴站乘坐地铁1线,在浦东国际机场站乘坐机场快线,前往上海浦东国际机场。3. 上海到南京,可以换乘上海地铁2号线,从南京站换乘地铁2线,再从南京南站换乘地铁1路,然后到达上海站"
      }
     ]
 }

infer

# infer_finetuning.py 推理微调模型
# infer_lora_finetuning.py 推理微调模型
# infer_ptuning.py 推理p-tuning-v2微调模型
 python infer_finetuning.py

training

    #制作数据
    python data_utils.py
    注: num_process_worker 为多进程制作数据 , 如果数据量较大 , 适当调大至cpu数量
    dataHelper.make_dataset_with_args(data_args.train_file,mixed_data=False, shuffle=True,mode='train',num_process_worker=0)
    
    #训练
    python train.py

训练参数

训练参数

友情链接

纯粹而干净的代码

Star History

Star History Chart

About

baichuan-13b finetuning and alpaca finetuning

License:Apache License 2.0


Languages

Language:Python 100.0%