Skip to content

conversion : fix Qwen3.5 MTP config lookup from text_config (fixes unslothai/unsloth#8443) - #102

Open
chakshu-dhannawat wants to merge 2 commits into
unslothai:masterfrom
chakshu-dhannawat:fix/qwen-mtp-text-config
Open

conversion : fix Qwen3.5 MTP config lookup from text_config (fixes unslothai/unsloth#8443)#102
chakshu-dhannawat wants to merge 2 commits into
unslothai:masterfrom
chakshu-dhannawat:fix/qwen-mtp-text-config

Conversation

@chakshu-dhannawat

Copy link
Copy Markdown

Fixes unslothai/unsloth#8443.

Qwen3.5/3.6 HF configs may nest num_hidden_layers and mtp_num_hidden_layers under text_config. _QwenMtpMixin.__init__ only read top-level keys, so a Qwen3.5 QLoRA -> GGUF export hit assert self.opt_num_mtp_layers != 0.

Changes:

  • Merge text_config into hparams inside _QwenMtpMixin.__init__, matching what index_tensors already does.
  • Replace the bare assert with an actionable ValueError when the MTP layer count is missing and has not yet been recovered from tensor names.

Added regression tests in conversion/tests/test_qwen_mtp.py.

AI assistance: Claude Sonnet helped implement the fix and tests.

…slothai/unsloth#8443)

- Merge text_config into hparams inside _QwenMtpMixin.__init__ so
  num_hidden_layers and mtp_num_hidden_layers are visible when nested.
- Replace the bare assert with an actionable ValueError when the MTP
  layer count is missing and has not yet been recovered from tensors.

Assisted-by: Claude Sonnet

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0bc358a61e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread conversion/qwen.py Outdated
Comment on lines +301 to +304
# The count is recovered from tensor names in `filter_tensors`, which
# runs during `index_tensors` - strictly after __init__. On a cold
# process the class attribute is still 0, so the old assert gave the
# user nothing actionable. Fail with a clear message instead.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid hard-wrapping the explanatory comment

This new comment block is split mid-sentence to fit a fixed width, and it is also more verbose than needed for the nearby code. Please either remove the extra explanation or keep any necessary sentence on a natural line so it follows the repository's comment standards.

AGENTS.md reference: AGENTS.md:L74-L81

Useful? React with 👍 / 👎.

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.

GGUF export of Qwen3.5 fails on assert self.opt_num_mtp_layers != 0 when MTP config is nested under text_config

1 participant