Repository navigation
Replies: 2 comments
|
你的 ds_z3_moe.json 和仓库自带的 examples/deepspeed/ds_z3_config.json 不一样:自带配置里 reduce 和 prefetch 的 bucket 大小用 "auto",stage3_max_live_parameters 和 stage3_max_reuse_distance 用 1e9。LlamaFactory 把你这个 30B-A3B MoE 模型的稀疏 MoE 块设成了 ZeRO-3 leaf 模块,DeepSpeed 进入 leaf 模块时会预取它所有子模块的参数,所以同一层的专家会被一起 gather。issue #9448 里有位贡献者用自带配置在单机 8 卡上跑过这个模型的 LoRA,每卡约 15G(昇腾 NPU,batch 1,cutoff 2048)。建议先换回自带配置、per_device_train_batch_size: 1 再试,还不行再试 ds_z3_offload_config.json。我在 CloudGPU 工作,没在 L20 上复现过。 |
|
你的 自带的官方配置"zero_optimization": {
"stage": 3,
"overlap_comm": false,
"contiguous_gradients": true,
"sub_group_size": 1e9,
"reduce_bucket_size": "auto",
"stage3_prefetch_bucket_size": "auto",
"stage3_param_persistence_threshold": "auto",
"stage3_max_live_parameters": 1e9,
"stage3_max_reuse_distance": 1e9,
"stage3_gather_16bit_weights_on_model_save": true
}你的配置与之对比
为什么这些会 OOM
直接改法先用官方配置,只改 stage: {
"train_batch_size": "auto",
"train_micro_batch_size_per_gpu": "auto",
"gradient_accumulation_steps": "auto",
"gradient_clipping": "auto",
"zero_allow_untested_optimizer": true,
"bf16": { "enabled": "auto" },
"zero_optimization": {
"stage": 3,
"overlap_comm": false,
"contiguous_gradients": true,
"sub_group_size": 1e9,
"reduce_bucket_size": "auto",
"stage3_prefetch_bucket_size": "auto",
"stage3_param_persistence_threshold": "auto",
"stage3_max_live_parameters": 1e9,
"stage3_max_reuse_distance": 1e9,
"stage3_gather_16bit_weights_on_model_save": true
}
}
MoE 额外的几件事
验证方式改完后观察 |
Uh oh!
There was an error while loading. Please reload this page.
8卡L20:48GB*8
CPU RAM:480GB
训练配置文件:
基座 bf16 权重 61GB,但每次加载完模型权重后,都会OOM,怀疑是ZeRO-3 all-gather 缓冲导致,但无法定位排查
All reactions