Skip to content

deps(defuser): require 0.0.31 for GLM-4.x router tuple - #4056

Merged
Qubitium merged 1 commit into
mainfrom
fix/defuser-glm4-router-version
Nov 14, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/defuser-glm4-router-version

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #4055 (issue #4040, section F): the authoritative GLM-4.x router fix has moved upstream to Defuser. This PR raises the defuser floor and removes the temporary GPT-QModel shim.

Depends on ModelCloud/Defuser#72 and the 0.0.31 release. Draft until that release is on the index, because CI installs defuser>=0.0.31 from requirements.txt.

Changes

Area Change
requirements.txt defuser>=0.0.30 -> defuser>=0.0.31
requirements/tenstorrent-py312.txt defuser==0.0.30 -> defuser==0.0.31
gptqmodel/models/loader.py DEFUSER_MIN_VERSION = "0.0.31"; drop the shim call
gptqmodel/utils/hf_load.py drop the shim call from the reload path
gptqmodel/utils/defuser_compat.py deleted
tests/test_defuser_glm4_router_compat.py deleted (moved to Defuser)
tests/test_defuser_version_check.py 0.0.30 is now below the floor; 0.0.31 is supported
docs describe the upstream fix instead of the local shim

Defuser 0.0.31 unwraps (router_logits, topk_weights, topk_indices) to the raw logits inside route_tokens_to_experts() and keeps its own grouped top-k selection, so the routing math is byte-identical to the tensor path. GPT-QModel no longer needs to inspect forward source or wrap the method.

Validation

  • Defuser: tests/test_convert_model.py -> 54 passed; new tuple/tensor equivalence and full defused-model forward tests cover glm4_moe and glm4_moe_lite.
  • GPT-QModel: tests/test_defuser_version_check.py tests/test_require_pkgs.py -> 14 passed.
  • ruff check on every changed Python file -> All checks passed.
  • DEFUSER_MIN_VERSION, defuser_version_too_old("0.0.30"), and defuser_version_too_old("0.0.31") verified from the loader.

Release sequencing

  1. Review/merge fix(glm4_moe): accept Transformers 5.22 router tuple Defuser#72.
  2. Publish Defuser 0.0.31.
  3. Mark this PR ready; CI can then resolve defuser>=0.0.31.

Defuser 0.0.31 fixes the GLM-4.5/4.6/4.7 and GLM-4.7-Flash replacement
MoE blocks, which passed the Transformers 5.22 router tuple
(router_logits, topk_weights, topk_indices) into
route_tokens_to_experts() and crashed on .sigmoid().

Raise the floor to defuser>=0.0.31 and remove the local
gptqmodel/utils/defuser_compat.py shim now that the fix is upstream.
Update the Tenstorrent manifest pin, version-gate tests, and the
Transformers 5.22 compatibility docs.

Depends on ModelCloud/Defuser#72 and the 0.0.31 release.
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