unslothai/unsloth · error · ValueError

activation rotation names {len(missing)} fqn(s) this model d

Error message

activation rotation names {len(missing)} fqn(s) this model does not have (e.g. {missing[0]!r}); the checkpoint and this build disagree about the model

What it means

The checkpoint's rotation metadata lists fqns that do not exist in the loaded model's module tree. The checkpoint and this build disagree about the architecture (renamed, added, or removed layers), so the recorded rotation set cannot be installed.

Source

Thrown at studio/backend/core/inference/diffusion_convrot.py:353

    Call AFTER ``load_state_dict`` and BEFORE ``apply_small_m_padding``: after, because the meta
    retry path rebuilds the module from the config and would discard an earlier swap; before,
    because padding reparents the Linears under a wrapper while the recorded fqns name the
    unwrapped tree."""
    if not declares_rotation(metadata):
        return ()
    problem = rotation_metadata_error(metadata)
    if problem:
        raise ValueError(problem)

    from torch import nn

    group_size = int(metadata[ROTATION_GROUP_KEY])
    fqns = list(metadata[ROTATION_FQNS_KEY])
    modules = dict(transformer.named_modules())
    missing = [fqn for fqn in fqns if fqn not in modules]
    if missing:
        raise ValueError(
            f"activation rotation names {len(missing)} fqn(s) this model does not have "
            f"(e.g. {missing[0]!r}); the checkpoint and this build disagree about the model"
        )
    for fqn in fqns:
        module = modules[fqn]
        if not isinstance(module, nn.Linear):
            raise ValueError(f"activation rotation target {fqn!r} is not an nn.Linear")
        if is_rotated_linear(module):
            raise ValueError(f"activation rotation target {fqn!r} is already rotated")
        if module.in_features % group_size:
            raise ValueError(
                f"activation rotation target {fqn!r} has in_features {module.in_features}, "
                f"which the recorded group {group_size} does not divide"
            )
    # Every target is validated before ANY is swapped. A partial install is the one outcome worse
    # than either end state: the rotated half still renders, just wrongly, so there is nothing to
    # notice and nothing to fall back from.
    for fqn in fqns:

View on GitHub (pinned to 203007d190)

Solutions

  1. Re-match base model and checkpoint: both must come from the same architecture revision
  2. Re-run the offline rotation on the current model to regenerate matching metadata
  3. Fall back to the dense (unrotated) checkpoint — the prequant loader already converts this raise into a refused checkpoint plus dense fallback
  4. Verify with set(metadata[ROTATION_FQNS_KEY]) <= set(dict(transformer.named_modules())) before loading

Example fix

# before
apply_activation_rotation(transformer, metadata)  # metadata names 'layers.31.mlp.up'

# after
live = set(dict(transformer.named_modules()))
recorded = set(metadata[ROTATION_FQNS_KEY])
assert recorded <= live, f"checkpoint/model mismatch: {sorted(recorded - live)}"
apply_activation_rotation(transformer, metadata)
Defensive patterns

Strategy: validation

Validate before calling

def rotation_fqns_present(transformer, metadata) -> bool:
    live = set(dict(transformer.named_modules()))
    return set(metadata[ROTATION_FQNS_KEY]) <= live

Try / catch

try:
    apply_activation_rotation(transformer, metadata)
except ValueError as e:
    if "does not have" in str(e):
        return load_dense_fallback(metadata)  # checkpoint/model mismatch: refuse + dense
    raise

Prevention

When it happens

Trigger: Loading a rotated checkpoint onto a model whose named_modules() lacks one or more recorded fqns — e.g. an architecture revision that renamed projections, or loading the rotation metadata against a different base model.

Common situations: Base model weights updated to a new architecture revision while the rotation metadata stayed from the old one; loading a checkpoint fine-tuned from a variant with different layer naming; version skew between the build that rotated and the build that loads.

Related errors


AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15). Data as JSON: /api/errors/005837736d141527. Report an issue: GitHub.