-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DeepSeekV3-671B-BF16 Lora Finetune #6843
base: main
Are you sure you want to change the base?
Conversation
@xs1997zju 你好,这是使用了什么硬件资源配置跑起来的? |
# deepseek_v3 moe module set as leaf node | ||
for layer in model.model.layers: | ||
if 'DeepseekV3MoE' in str(type(layer.mlp)): | ||
layer.mlp._z3_leaf=True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
if model_type == "deepseek_v3":
_set_z3_leaf_modules(model, [model.model.layers[0].mlp.__class__])
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
if model_type == "deepseek_v3": _set_z3_leaf_modules(model, [model.model.layers[0].mlp.__class__])?
这样写看起来也ok, 可以直接调_set_z3_leaf_modules接口
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你好, 4机32卡 A卡 |
@xs1997 跑的lora训练吗?4机 A100-80G吗? |
@hiyouga 请问下你这边也有跑过v3-671B的lora不, 最大长度能训到多少? |
@xs1997zju 看机器数量。跑训练要修改 modeling 文件才行吧 |
你这边实际跑用了几机呢? |
|
8卡x10机, A卡还是H卡, 你测试过最大能训到多长的seq-len? 1024? 2048? @hiyouga |
lora rank多大? |
@hiyouga @xs1997zju 代码还不合呢 |
@hiyouga bf16? |
![]() |
这个commit: https://github.com/hiyouga/LLaMA-Factory/pull/6843/files/be21531bab79793c5fc87928d63d793ca6dd8e98 |
|
|
如果忽略掉的话,那整个MOE模块就不会更新参数了。这样的话,是load已有的模型还好,但是如果是想要借用该文件,从零开始train的话,就肯定不成了。 但是看deepseek V2的moe模块有相关的训练代码,在试能不能复用 |
为啥忽略掉就不会更新参数,是这个实现中topk_weight没有梯度吗?我现在没资源,你是跑过发现这个情况吗?还有我这里只是说MoEGate,DeepseekV3MoE哪个moe_infer还在看 |
可以看下,DeepseekV3MoE的forward函数,根据它现在的代码,训练时,返回值y 实际没有使用 self.gate函数的返回值进行计算 |
我们说的不是一件事 |
再等等应该差不多,主要是deepspeed _check_for_duplicates用循环硬写的,慢点正常,不愿意等可以和上面一样,在load_model前面添加
|
大佬,加了这行代码后又重启了下,还是卡在同样的位置,显存和上面一样都一直是14619MiB,没有看到任何变化的迹象(如果是在不断装参数,起码可以看到变化),目前已经等了20min。 |
好像在训练完成后保存模型的时候OOM了,我这里内存是2T,可以成功保存和merge lora吗,求问你们内存的峰值大概用到了多少 |
我这也是单机2T的内存,同样是在训练完成的时候由于内存占用过高被系统kill了。 |
@jiefisher 你这个怎么样 了? |
保存模型的时候 内存爆了 训练没问题 |
我用你的这个跑不起来,可以请问一下您是怎么跑的吗 |
@hiyouga hi, 这边有尝试过671B全量参数微调吗? 用的几机配置呢? |
@hiyouga 我也遇到了这个问题,我是12台机子 x 8卡,每台机子1T内存,保存模型时内存爆了,你上面提到你用10 x 8机子跑通过,能顺利保存模型吗 |
@jiefisher 保存模型的时候OOM了,请问有解决办法吗? |
我这边是国产的卡出现了nan,GPU这边我没遇到nan问题 |
@xs1997zju 可以的,我设的是4k,开了gradient checkpointing之后显存是完全够的,但速度。。。极慢。。。(我是Lora) |
有个办法,"stage3_gather_16bit_weights_on_model_save": false,ds里面设置一下,就不会把模型全部集中到master机的内存里了,但保存的文件会被切片。 @hiyouga lora训练时我设置了--save_only_model ,理论上应该只有adapter本身在保存时会占内存才对,但这里大家爆内存都是因为master机内存加载了整个BF16的R1 |
请问这个长度最大开多少呢,好像4096就会OOM,这个应该怎么解决呢 |
请问大家跑的是 deepseek_r1_671B 的模型吗,我在 lora 微调测试时,出现这个问题:raise ValueError(ValueError: Unknown quantization type, got fp8 - supported types are: ['awq', 'bitsandbytes_4bit', 'bitsandbytes_8bit', 'gptq', 'aqlm', 'quanto', 'eetq', 'hqq', 'compressed-tensors', 'fbgemm_fp8', 'torchao'] 请问是不是需要先通过 fp8_cast_bf16.py 将 deepseek_R1_671B 模型从 FP8 格式,转成 BF16 格式再进行训练呢? llama factory 目前是不是不支持 FP8 格式 的模型训练呢? |
@Tongmengfei It doesn't support fp8 training. It's shown in the config but everyone is using the https://huggingface.co/opensourcerelease/DeepSeek-V3-bf16/tree/main version |
请问你在使用 DeepSeek-V3-bf16 模型的时候,是否出现了以下的问题呢: |
I did not get this error. LLaMA-Factory doesn't support MTP training so it should just ignore the model.layers.61 weights |
我在merge lora adapter,load模型时也遇到这个问题,所以该怎么解决 |
你好,上述问题我是在 gpu_num=4 的时候遇到的,当我把 gpu_num=8 扩大加载资源时,上述问题没有再出现; |
Hi,我想请问一下这个问题解决了吗? |
我按这个设置切片保存了,但权重文件无法用我之前的推理框架读取运行,是需要用deepspeed官方给的那个合并代码合并一下吗? |
|
请问大家在训练 deepseek R1 671B 模型时,使用 deepspeed zero3 ,是否有遇到 Some NCCL operations have failed or timed out. 这个问题呢? 具体报错如下: 我用的配置是 ds_z3_config.json |
What does this PR do?
DeepSeekV3-671B-BF16 Lora Finetune
Fixes #6824
Fixes #6829
Before submitting