Skip to content

fix(runtime): handle tied embeddings in convert_qwen35.py (fixes #219)#220

Open
minion1227 wants to merge 1 commit into
gittensor-ai-lab:mainfrom
minion1227:minion_219
Open

fix(runtime): handle tied embeddings in convert_qwen35.py (fixes #219)#220
minion1227 wants to merge 1 commit into
gittensor-ai-lab:mainfrom
minion1227:minion_219

Conversation

@minion1227

Copy link
Copy Markdown

Summary

Fixes #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. This falls 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.

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.

  • Tested on RTX 5090 (sm_120)

Decode tok/s: n/a (no runtime speed change).

…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.
@ai-hpc ai-hpc added area:runtime subsystem (emission weight 0.26) not-tested Awaiting maintainer approval to run on RTX 5090; not evaluated labels Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:runtime subsystem (emission weight 0.26) not-tested Awaiting maintainer approval to run on RTX 5090; not evaluated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(runtime): convert_qwen35.py crashes (KeyError) on tied-embedding checkpoints

2 participants