fix(runtime): handle tied embeddings in convert_qwen35.py (fixes #219)#220
Open
minion1227 wants to merge 1 commit into
Open
fix(runtime): handle tied embeddings in convert_qwen35.py (fixes #219)#220minion1227 wants to merge 1 commit into
minion1227 wants to merge 1 commit into
Conversation
…ensor-ai-lab#219) convert_qwen35.py read lm_head.weight unconditionally, so a checkpoint that ties its input/output embeddings (no lm_head.weight tensor) aborted conversion with a KeyError. Fall back to model.embed_tokens.weight when lm_head.weight is absent — the same [vocab, hidden] layout, mirroring convert_gguf.py's existing tied-weight handling. Untied checkpoints are unaffected.
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.
Summary
Fixes #219.
convert_qwen35.pyreadlm_head.weightunconditionally, so a checkpoint that ties its input/output embeddings (nolm_head.weighttensor) aborted conversion with aKeyError. This falls back tomodel.embed_tokens.weightwhenlm_head.weightis absent - the same[vocab, hidden]layout, mirroringconvert_gguf.py's existing tied-weight handling. Untied checkpoints are unaffected.Proof of speedup
Not a performance change - host-side weight-conversion robustness fix, off the decode/benchmark path. No decode tok/s impact, so the RTX 5090 box is intentionally left unticked.
sm_120)Decode tok/s: n/a (no runtime speed change).