You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] lm_head=True is rejected as "tied weights" on untied composite/VLM models whose nested text_config says tied, e.g. Qwen3-VL-30B-A3B (regression from 82ab6f1, #4184) #4369
The new walker returns True if any nested text_config has tie_word_embeddings=True.
In transformers 5, the class-level _tied_weights_keys always contains lm_head.weight, so the "declared tied" branch is taken as well.
Qwen3-VL-30B-A3B-Instruct has top-level tie_word_embeddings=False. Its text_config defaults to True, but HF does not tie the weights: find_tied_parameters returns [].
The same false positive occurs after untie_word_embeddings(), which clears only the top-level flag, on any composite model whose text_config says tied.
Repro
importtorchfromtypesimportSimpleNamespacefromtransformersimportAutoConfig, AutoModelForImageTextToTextfromgptqmodel.looper.module_looperimportModuleLoopercfg=AutoConfig.from_pretrained("Qwen/Qwen3-VL-30B-A3B-Instruct")
withtorch.device("meta"): m=AutoModelForImageTextToText.from_config(cfg)
m.tie_weights()
fake=SimpleNamespace(gptq_model=SimpleNamespace(model=m, lm_head="lm_head", turtle_model=None))
print(m.get_input_embeddings().weightism.get_output_embeddings().weight, # FalseModuleLooper._lm_head_is_tied(fake)) # True at HEAD, False at 842d666
Expected:_lm_head_is_tied returns False, so quantize() with lm_head=True proceeds.
Actual: it raises NotImplementedError("quantization of lm_head layer with tied weights is not supported").
Suggestion: decide by actual storage identity (get_input_embeddings().weight vs get_output_embeddings().weight, or find_tied_parameters), not by nested config flags.
Found during an AI-assisted review (Claude Code, round 12) of def6e61; repros were run at that commit (A/B against 842d666 where noted) on RTX 4090/5090 (CUDA 13) and/or Radeon AI PRO R9700 (ROCm) unless marked static/suspected.
Confirmed independently by a second reviewer. HF's get_expanded_tied_weights_keys() returns no lm_head key for Qwen3-VL-30B-A3B, because HF reads the top-level self.config.tie_word_embeddings.
Cross-checks with the current code:
Qwen2.5-VL-7B and llava-next-8b: untied, return False. Correct.
gemma-3-4b and Qwen3-VL-2B: truly tied, return True. Correct, and an improvement over 842d666.
So the fix only needs to read the same config HF ties from.
Taking this. I'll investigate against current main, add a targeted regression test, and open a PR. Will report back here if the claim turns out to be invalid or already fixed.
Activity
Qubitium commentedon Nov 16, 2026
Confirmed independently by a second reviewer. HF's
get_expanded_tied_weights_keys()returns no lm_head key for Qwen3-VL-30B-A3B, because HF reads the top-levelself.config.tie_word_embeddings.Cross-checks with the current code:
842d666.So the fix only needs to read the same config HF ties from.
Qubitium commentedon Nov 16, 2026
Taking this. I'll investigate against current
main, add a targeted regression test, and open a PR. Will report back here if the claim turns out to be invalid or already fixed.fix(looper): detect tied lm_head from storage identity, not nested co…
fix(vl): keep an untied InternVL lm_head through lazy load and save (#…
fix(vl): tie an InternVL head from the wrapper flag and checkpoint ev…