fix(compat): handle DeepseekV2MoE→DeepseekV2Moe Transformers rename - #150
Merged
Conversation
added 2 commits
August 14, 2026 09:18
Newer Transformers renamed DeepseekV2MoE to DeepseekV2Moe (lowercase 'e') and removed the standalone DeepseekV2MoEGate class entirely. Changes: - moe_infinity/models/deepseek.py: replace hard DeepseekV2MoEGate import with getattr fallback; when the class is absent (new Transformers) fall back to the local DeepseekMoEGate which has the same raw-logits interface. - tests/python/ops/test_deepseek_v2_gate_consistency.py: resolve DeepseekV2MoE via getattr (supports both spellings); guard the two MoEGate-comparison tests with @requires_moe_gate so they skip gracefully when DeepseekV2MoEGate is unavailable. model_offload.py already had the dual-spelling guard from commit 48d5385.
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.
Current Transformers renamed
DeepseekV2MoE→DeepseekV2Moeand droppedDeepseekV2MoEGate, causingAttributeError/ImportErroron DeepSeek-V2 load.Fix: dual-spelling
getattrfallbacks inmoe_infinity/models/deepseek.py(falls back to localDeepseekMoEGatewhen the transformers gate class is absent);test_deepseek_v2_gate_consistency.pyimports made robust +@requires_moe_gateskip for the removed class. (model_offload.pyalready had the guard from 48d5385.)Surfaced by: the #133 topology smoke test. Verified:
import moe_infinityexit 0, MoE class resolves toDeepseekV2Moe, ruff + LSP clean, weights-backed smoke OK. Minimal bugfix, no refactor.