Repository navigation
Do not count MoE tokens during evaluation - #4148
Conversation
|
Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
|
|
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
tianyu-l
left a comment
There was a problem hiding this comment.
Sounds legit. Let's stop bleeding and worry about inference metrics later. @felipemello1
|
lgtm! we are not logging tokens_per_expert_E during training and inference at all right? |
MoE.forward()currently updatestokens_per_expert_Ein eval mode. Validation runs after the optimizer hook has consumed and cleared the training counts, so validation routing counts can leak into the next step'sexpert_bias_Eupdate.torch.no_grad()does not prevent this buffer mutation.Only accumulate the counter while the module is in training mode. Activation-checkpoint recomputation still runs in training mode, so its existing behavior is unchanged.
Added a CPU regression test that first records training counts, then verifies an eval forward leaves them unchanged.
Tests:
python -m pytest -q tests/unit_tests/test_moe.py tests/unit_tests/test_optimizer_param_groups.py tests/unit_tests/test_inference_moe.py tests/unit_tests/test_gpt_oss_moe.py(28 passed)torchtitan/models/common/moe.py(0 errors)