Skip to content

[Bug]: dry-run estimation should fall back to text_config for Qwen3.5-MoE #1689

Description

@SeanThomasWilliams

Problem

The dry-run estimation path reads model-shape fields only from the top-level config object.

Qwen3.5-MoE keeps the relevant fields under text_config, so the estimator cannot count parameters correctly for that model family.

Affected code

  • auto_round/estimation.py:48-56
  • auto_round/estimation.py:216-217

Repro

This reproduces with the Qwen3.5 MoE config shape:

python - <<'PY'
from transformers import AutoConfig

cfg = AutoConfig.from_pretrained("Qwen/Qwen3.5-35B-A3B", trust_remote_code=True)
print("top-level hidden_size:", getattr(cfg, "hidden_size", None))
print("nested hidden_size:", getattr(cfg.text_config, "hidden_size", None))
PY

Expected result:

  • the estimator should fall back to cfg.text_config for fields such as hidden_size, num_hidden_layers, intermediate_size, and vocab_size

Actual result:

  • those top-level fields are None for Qwen3.5-MoE-style configs, so parameter counting and the estimate result break or undercount

If you run the dry-run path against Qwen/Qwen3.5-35B-A3B, it cannot size the model correctly for this reason.

Why this matters

Dry-run estimation is most useful on large MoE models where memory headroom is tight.

Qwen3.5-MoE is one of those models.

Suggested fix

Add a small helper that reads each required field from the top-level config first and then falls back to config.text_config when present.

Use that helper in both _count_parameters() and _build_estimate_result().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions