Skip to content

fix(compat): handle DeepseekV2MoE→DeepseekV2Moe Transformers rename - #150

Merged
drunkcoding merged 2 commits into
devfrom
fix/deepseek-v2-moe-rename
Aug 14, 2026
Merged

fix(compat): handle DeepseekV2MoE→DeepseekV2Moe Transformers rename#150
drunkcoding merged 2 commits into
devfrom
fix/deepseek-v2-moe-rename

Conversation

@drunkcoding

Copy link
Copy Markdown
Contributor

Current Transformers renamed DeepseekV2MoEDeepseekV2Moe and dropped DeepseekV2MoEGate, causing AttributeError/ImportError on DeepSeek-V2 load.

Fix: dual-spelling getattr fallbacks in moe_infinity/models/deepseek.py (falls back to local DeepseekMoEGate when the transformers gate class is absent); test_deepseek_v2_gate_consistency.py imports made robust + @requires_moe_gate skip for the removed class. (model_offload.py already had the guard from 48d5385.)

Surfaced by: the #133 topology smoke test. Verified: import moe_infinity exit 0, MoE class resolves to DeepseekV2Moe, ruff + LSP clean, weights-backed smoke OK. Minimal bugfix, no refactor.

drunkcoding 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.
@drunkcoding
drunkcoding merged commit 0e4904f into dev Aug 14, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant