/chatyuan_finetuning

clue chatyuan finetuning

Primary LanguagePython

update information

    06-01 支持lora deepspeed 训练,0.1.9 和 0.1.10合并
    05-27 add qlora transformers>=4.30
    05-24 lora v2

install

dev 版本可通过下列方式安装 
pip 安装rc 版本
pip install -U -i https://pypi.org/simple deep_training==0.1.10
pip install -U bitsandbytes>=0.39
pip install -q -U git+https://github.com/huggingface/transformers.git

weight

data sample

单条数据示例
{
    "id": 0, "paragraph": [
        #一轮会话
        {
            "q": "从南京到上海的路线",
            "a": [
                "你好,南京到上海的路线如下:",
                "1. 南京到上海,可以乘坐南京地铁1号线,在南京站乘坐轨道交通1号线。",
                "2. 南京到浦东机场,可以搭乘上海地铁1号,在陆家嘴站乘坐地铁1线,在浦东国际机场站乘坐机场快线,前往上海浦东国际机场。",
                "3. 上海到南京,可以换乘上海地铁2号线,从南京站换乘地铁2线,再从南京南站换乘地铁1路,然后到达上海站"
            ]
        }
        #二轮....
    ]
}

使用方法

默认不使用滑动窗口
data_conf = {
    'stride': 0,
    #滑动窗口 , 数据多则相应增大,否则减小 ,stride <=0 则禁用滑动窗口
}

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

训练参数

训练参数

友情链接

纯粹而干净的代码