Skip to content

[BUG] Ling-2.6-flash (model_type=bailing_hybrid, remote-code layout) can't be loaded: GPTQModel forces native transformers, which crashes. The remote-code tree would also miss the MLA projections. #4373

Closed

Description

@Qubitium

Severity: high for this model family. Status: load crash confirmed on CPU at def6e61; the tree gap is from static analysis.

Where

  • gptqmodel/utils/hf.py:938-960 (resolve_trust_remote_code)
  • gptqmodel/models/definitions/bailing_moe.py:46-49

Description

Wrong loader override. resolve_trust_remote_code decides from model_type alone. The two layouts that share model_type=bailing_hybrid differ:

Ling-2.6-flash Native BailingHybrid (Ling 3.0)
Modeling code Its own, via auto_map transformers
Attention attention.query_key_value, attention.g_proj q_proj only, separate q/k/v for linear attention
MLA Yes, q_lora_rank=1536 (attention.q_a_proj / q_b_proj / kv_a_proj_with_mqa / kv_b_proj / dense) No q_lora

resolve_trust_remote_code(path, trust_remote_code=True) logs "overriding trust_remote_code=True to False" and returns False. The native load then fails:

from transformers import AutoModelForCausalLM
from gptqmodel.utils.hf import resolve_trust_remote_code
resolve_trust_remote_code("inclusionAI/Ling-2.6-flash", trust_remote_code=True)    # -> False
AutoModelForCausalLM.from_pretrained("inclusionAI/Ling-2.6-flash", trust_remote_code=False,
                                     num_hidden_layers=1, device_map="cpu")
# RuntimeError: The size of tensor a (32) must match the size of tensor b (16)  (_init_weights, inv_freq copy)

Tree gap on the remote-code path. Even if the override is fixed, BailingMoeQModel's attention branch declares only query_key_value:0 and dense:1. The real checkpoint has model.layers.N.attention.{q_a_proj, q_b_proj, kv_a_proj_with_mqa, kv_b_proj, g_proj}. None of these resolve to a spec, and layer_modules_strict=False, so they would silently stay BF16.

Expected

  • Respect an explicit trust_remote_code=True, or detect the layout from auto_map or the weight names, when a checkpoint ships remote code whose layout differs from the native one.
  • Declare the remote MLA branch: attention.{q_a_proj:0, kv_a_proj_with_mqa:0, g_proj:0, q_b_proj:1, kv_b_proj:1, dense:2}.

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.

Activity

  1. added
    bug
    on Nov 16, 2026
  2. Qubitium commented on Nov 16, 2026

    @Qubitium
    CollaboratorAuthor

    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.

  3. self-assigned this
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions