_LOAD_BALANCING_LOSS returns empty list sometimes
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- python
调研方向
从 megablocks/layers/moe.py 中链接的行开始,然后跟踪 savanna/training.py 中显示的调用者,尤其是 mb_moe_loss_func。复现 expert_interval=2 和 expert_interval=1 两种情况,并将 layer 数量与 loss 条目进行比较;完成的标准是:该差异以及间歇性为空的 _LOAD_BALANCING_LOSS 都有记录在案的根本原因,并且有回归测试或范围明确的修复。
由索引模型根据 Issue 内容生成。
描述
Hello, I am using Eleuther AI's gpt-neox implementation with megablocks, but I get 2 errors related to the _LOAD_BALANCING_LOSS.
- the
tokens_per_expertgives me this error at this line.ValueError: Expected 14 token_per_experts but found 7.Here's the stack trace.
File "/home/etnguyen/test/savanna/train.py", line 10, in <module> [53/1963]
pretrain(global_config=global_config)
File "/home/etnguyen/test/savanna/savanna/training.py", line 228, in pretrain
iteration = train(
^^^^^^
File "/home/etnguyen/test/savanna/savanna/training.py", line 1004, in train
loss_dict, skipped_iter = train_step(
^^^^^^^^^^^
File "/home/etnguyen/test/savanna/savanna/training.py", line 919, in train_step
loss = forward_step(
^^^^^^^^^^^^^
File "/home/etnguyen/test/savanna/savanna/training.py", line 515, in forward_step
moe_loss = mb_moe_loss_func(global_config, loss_mask, outputs)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/etnguyen/test/savanna/savanna/training.py", line 464, in mb_moe_loss_func
lbl = moe.batched_load_balancing_loss(megablocks_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/etnguyen/.local/lib/python3.11/site-packages/megablocks/layers/moe.py", line 43, in batched_load_balancing_loss
raise ValueError(
ValueError: Expected 14 token_per_experts but found 7.
num_layers = 14
pipeline_model_parallel_size = 1
num_layers_per_virtual_pipeline_stage = None
I get this error when the expert_interval=2, ie when the default value is used, and so the number of experts is actually half the number of layers (14 layers, 7 Megablocks layers used). This error gets fixed when I set the expert_interval=1 so that there are 14 Megablocks, and 14 layers. But I don't know the root cause of this discrepancy, especially if I want to change the expert_interval and number of Megablocks to every other layer.
- The second issue is, let's say I do use
expert_interval=1to get around the issue above, so every layer uses a Megablock, then my next error I get is that the return value of get_load_balancing_loss occasionally returns an empty list, which then errors out, meaning the_LOAD_BALANCING_LOSSis an empty list. Critically, this happens part way through training, like 30 secs in, so some batches it's fine and returns the expected losses.
Does this sound familiar to anybody? I'd very much appreciate any insights, thank you!
- 主要语言
- Python
- 星标
- 1.6k
- 派生
- 228
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 86/100
-
Validate finite output clamping limits in StepPredictor.prepare_clamping_params to prevent silent NaN/Inf propagation可能已有人在做 @muskan-creates352 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
mllam/neural-lam#848 ·
维护者通常 2 天内回复
-
infra
难度 1/5 1 小时以内 新手友好度 88/100
fab-geocommuns/RNB-coeur#1166 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
deepspeedai/DeepSpeed#8951 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
aws/context-ontology-accelerator#343 ·
维护者通常 1 天内回复