Text Generation
Transformers
PyTorch
Chinese
English
llama
text-generation-inference

可以提供一下训练代码吗?

#5
by puppet1988 - opened

你好,可以提供一下训练代码吗? 或者说对原始fastchat的数据预处理和训练流程有什么改动吗? 我这边拿fastchat进行sft,一个是loss降不下来,另外就是在某些特定样本上会出现cuda的错误

您好,我上传了训练代码:https://huggingface.co/fireballoon/baichuan-vicuna-7b/blob/main/train_vicuna.py
训练代码是在fastcode代码的基础上魔改的,用accelerate和deepspeed加速训练:accelerate launch --config_file zero3_bf16_config.yaml train_vicuna.py
希望对您有帮助😆

您好,我上传了训练代码:https://huggingface.co/fireballoon/baichuan-vicuna-7b/blob/main/train_vicuna.py
训练代码是在fastcode代码的基础上魔改的,用accelerate和deepspeed加速训练:accelerate launch --config_file zero3_bf16_config.yaml train_vicuna.py
希望对您有帮助😆

点赞,请问训练需要什么配置的服务器,8卡V100是否能训练呢

我使用8卡A100-40G进行训练。
在V100上可以考虑减小单卡batch_size(我使用单卡batch_size=4),减小max_length(我使用max_length=4096)。

我使用8卡A100-40G进行训练。
在V100上可以考虑减小单卡batch_size(我使用单卡batch_size=4),减小max_length(我使用max_length=4096)。

请问一般需要几个epoch

一般训练3 epoch

这个模型生成的文件怎么转化为标准格式

我将训练代码保存模型的地方修改为model.save_pretrained 发现无法用fastchat加载模型

需要将Deepspeed权重转化为pytorch权重,我的流程如下:

  1. 保存模型时候会自动在保存目录下生成zero_to_fp32.py,在对应目录下:
python zero_to_fp32.py . pytorch_model.bin
  1. 用获得的pytorch_model.bin覆盖https://huggingface.co/fireballoon/baichuan-llama-7b 中的pytorch_model.bin
  2. optional 用Transformers load模型,再用model.save_pretrained("some/path")保存切成10G大小的float16权重
This comment has been hidden

请问训练代码learning rate是不变的吗

是的

Sign up or log in to comment