Summary
SyncGlmMoeDsaMoEBlock hard-depends on a HuggingFace internal method that is not present across the pinned transformers>=5.3.0,<6 range:
# moe_infinity/models/glm_moe_dsa.py:62 (in __init__)
self._hf_route_tokens = GlmMoeDsaMoE.route_tokens_to_experts
# ...
# :71 (in _route)
return self._hf_route_tokens(self, router_logits)
The wrapper borrows HF's unbound route_tokens_to_experts to guarantee routing parity, with no hasattr/version guard. On any transformers where transformers.models.glm_moe_dsa exists but GlmMoeDsaMoE has no route_tokens_to_experts, this raises:
AttributeError: type object 'GlmMoeDsaMoE' has no attribute 'route_tokens_to_experts'
at instantiation (not just under test) — so GLM-5.2 offload is broken on those versions, not merely a test failure.
Impact / where it shows
- CI
unit-tests (3.10) and unit-tests (3.12): tests/python/unit/test_glm_routing.py::test_routing_parity FAILS.
- The default
unit-tests job passes only because its transformers lacks glm_moe_dsa entirely, so the test is importorskip-skipped.
- This is pre-existing on
feat/dflash-tracks-abcd (independent of the #143 merge / model_offload.py conflict resolution).
Proposed fix (author to confirm intent)
Pick one:
- Pin
transformers to a version range that guarantees GlmMoeDsaMoE.route_tokens_to_experts (tighten the >=5.3,<6 pin).
- Guarded fallback:
getattr(GlmMoeDsaMoE, "route_tokens_to_experts", None), and if absent, reimplement the routing inline (version-independent) instead of borrowing the HF internal.
- Gate the whole GLM registration on the specific
transformers version that provides the API.
Acceptance criteria
Context
Surfaced while converging the DFlash stack to dev (#143). Related GLM work: #130.
Summary
SyncGlmMoeDsaMoEBlockhard-depends on a HuggingFace internal method that is not present across the pinnedtransformers>=5.3.0,<6range:The wrapper borrows HF's unbound
route_tokens_to_expertsto guarantee routing parity, with nohasattr/version guard. On anytransformerswheretransformers.models.glm_moe_dsaexists butGlmMoeDsaMoEhas noroute_tokens_to_experts, this raises:at instantiation (not just under test) — so GLM-5.2 offload is broken on those versions, not merely a test failure.
Impact / where it shows
unit-tests (3.10)andunit-tests (3.12):tests/python/unit/test_glm_routing.py::test_routing_parityFAILS.unit-testsjob passes only because itstransformerslacksglm_moe_dsaentirely, so the test isimportorskip-skipped.feat/dflash-tracks-abcd(independent of the#143merge /model_offload.pyconflict resolution).Proposed fix (author to confirm intent)
Pick one:
transformersto a version range that guaranteesGlmMoeDsaMoE.route_tokens_to_experts(tighten the>=5.3,<6pin).getattr(GlmMoeDsaMoE, "route_tokens_to_experts", None), and if absent, reimplement the routing inline (version-independent) instead of borrowing the HF internal.transformersversion that provides the API.Acceptance criteria
SyncGlmMoeDsaMoEBlockinstantiates on all supportedtransformersversions in the pin.test_glm_routing.py::test_routing_paritypasses (or is correctly skipped) across the CI matrix.Context
Surfaced while converging the DFlash stack to
dev(#143). Related GLM work: #130.