Fix DeepSpeedInferenceConfig crash on bool moe backward-compat value#8145
Merged
Merged
Conversation
Signed-off-by: winklemad <winklemad@outlook.com>
winklemad
requested review from
hwchen2017,
loadams,
tjruwase and
tohtana
as code owners
July 15, 2026 09:43
tohtana
approved these changes
Jul 16, 2026
tohtana
left a comment
Collaborator
There was a problem hiding this comment.
Great catch, thank you @winklemad!
tohtana
enabled auto-merge
July 16, 2026 21:52
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 16, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 16, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 16, 2026
Merged
via the queue into
deepspeedai:master
with commit Jul 17, 2026
17e19b1
13 of 15 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DeepSpeedInferenceConfig.moeis typedUnion[bool, DeepSpeedMoEConfig], and themoe_backward_compatvalidator explicitly handles the bool form (the oldinit_inference(..., moe=<bool>)interface). But it buildsDeepSpeedMoEConfig(moe=field_value)— andDeepSpeedMoEConfighas nomoefield (it hasenabled). SinceDeepSpeedConfigModelsetsextra="forbid", every boolmoeraises aValidationErrorinstead of building the config:Both
moe=Trueandmoe=Falsecrash, so the documented backward-compat path is unusable. The fix passesenabled=field_value(the actual field) so the bool is turned into aDeepSpeedMoEConfigas intended.The line dates back to #2516 and survived the pydantic-v2 migration (#5167) unchanged.
Added a regression test (
test_moe_backward_compat_bool) asserting the bool form builds aDeepSpeedMoEConfigwith the matchingenabled.yapfandflake8clean.