DeepSpeed
17e19b19 - Fix DeepSpeedInferenceConfig crash on bool moe backward-compat value (#8145)

Commit
47 days ago
Fix DeepSpeedInferenceConfig crash on bool moe backward-compat value (#8145) `DeepSpeedInferenceConfig.moe` is typed `Union[bool, DeepSpeedMoEConfig]`, and the `moe_backward_compat` validator explicitly handles the bool form (the old `init_inference(..., moe=<bool>)` interface). But it builds `DeepSpeedMoEConfig(moe=field_value)` — and `DeepSpeedMoEConfig` has no `moe` field (it has `enabled`). Since `DeepSpeedConfigModel` sets `extra="forbid"`, every bool `moe` raises a `ValidationError` instead of building the config: ```python >>> from deepspeed.inference.config import DeepSpeedInferenceConfig >>> DeepSpeedInferenceConfig(moe=True) pydantic_core._pydantic_core.ValidationError: 1 validation error for DeepSpeedMoEConfig moe Extra inputs are not permitted [type=extra_forbidden, ...] ``` Both `moe=True` and `moe=False` crash, so the documented backward-compat path is unusable. The fix passes `enabled=field_value` (the actual field) so the bool is turned into a `DeepSpeedMoEConfig` as 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 a `DeepSpeedMoEConfig` with the matching `enabled`. `yapf` and `flake8` clean. Signed-off-by: winklemad <winklemad@outlook.com>
Author
Parents
Loading