huggingface/transformers · error · AttributeError

{type(obj).__name__} has none of: {names}

Error message

{type(obj).__name__} has none of: {names}

What it means

Error "{type(obj).__name__} has none of: {names}" thrown in huggingface/transformers.

Source

Thrown at src/transformers/integrations/finegrained_fp8.py:70

def _get_ue8m0_dtype() -> torch.dtype:
    """Return ``torch.float8_e8m0fnu`` or raise a clear error on torch without FP8 support.

    UE8M0 scales are always stored/consumed as this single dtype — the kernels (Triton
    finegrained + DeepGEMM) read it natively, and supporting the same scales in mixed
    container dtypes would be a mess — so fail loudly rather than fall back."""
    if not hasattr(torch, "float8_e8m0fnu"):
        raise RuntimeError(
            "scale_fmt='ue8m0' requires torch.float8_e8m0fnu, which is only available in "
            f"PyTorch >= 2.7 (found {torch.__version__}). Upgrade torch to use UE8M0 FP8 checkpoints."
        )
    return torch.float8_e8m0fnu


def _first_attr(obj, *names):
    for name in names:
        if hasattr(obj, name):
            return getattr(obj, name)
    raise AttributeError(f"{type(obj).__name__} has none of: {names}")


@dataclass(frozen=True)
class FineGrainedFP8:
    """Entry points exposed by the `kernels-community/finegrained-fp8` Triton kernel."""

    matmul: Callable
    batched_matmul: Callable
    grouped_matmul: Callable


# Cache the loaded kernel but not failures: re-checking each call is cheap and intended, since the env
# can change between attempts. A module global (not `@functools.cache`) avoids Dynamo warning about
# tracing a cache-wrapped function on every compile.
_FINEGRAINED_FP8: FineGrainedFP8 | None = None


@torch._dynamo.allow_in_graph

View on GitHub (pinned to a597f97485)

Solutions

  1. Pass an object exposing one of the listed attribute names.
  2. Rename/provide the expected attribute on the object.

When it happens

Trigger: Raised in finegrained FP8 helpers when an object has none of the expected attribute names.

Common situations: Accessing alternate attribute names (e.g. weight_scale vs scale) on a quantized module that defines none of them.


AI-assisted analysis of huggingface/transformers@a597f97485 (2026-08-14). Data as JSON: /api/errors/b1f3799626e3d660. Report an issue: GitHub.