huggingface/transformers · error · ValueError

Unsupported export config: {export_config_dict!r}. Registere

Error message

Unsupported export config: {export_config_dict!r}. Registered exporters: {sorted(AUTO_EXPORTER_MAPPING)}.

What it means

Raised by AutoHfExporter.from_config when supports_export_format() returns False for the supplied config — i.e. its 'export_format' is missing entirely, unknown, or only half-registered (a config class exists but no exporter class, or vice versa). The message shows the offending dict and the sorted list of fully registered exporter names ('dynamo', 'onnx', 'executorch').

Source

Thrown at src/transformers/exporters/auto.py:81

                f"Unknown exporter type, got {name} - supported exporters are: {list(AUTO_EXPORT_CONFIG_MAPPING.keys())}"
            )

        target_cls = AUTO_EXPORT_CONFIG_MAPPING[name]
        return target_cls.from_dict(export_config_dict)


class AutoHfExporter:
    """
    The Auto-HF expoerter class that takes care of automatically instantiating to the correct
    `HfExporter` given the `ExportConfig`.
    """

    @classmethod
    def from_config(cls, export_config: ExportConfigMixin | dict, **kwargs) -> HfExporter:
        # Normalize to a dict so ``supports_export_format`` can act as the single gate.
        export_config_dict = export_config.to_dict() if isinstance(export_config, ExportConfigMixin) else export_config
        if not cls.supports_export_format(export_config_dict):
            raise ValueError(
                f"Unsupported export config: {export_config_dict!r}. "
                f"Registered exporters: {sorted(AUTO_EXPORTER_MAPPING)}."
            )

        export_format = export_config_dict["export_format"]
        name = export_format.value if isinstance(export_format, ExportFormat) else export_format
        return AUTO_EXPORTER_MAPPING[name](**kwargs)

    @classmethod
    def from_pretrained(cls, pretrained_model_name_or_path, **kwargs) -> HfExporter | None:
        """
        Load an exporter instance from a pretrained model/checkpoint that ships an export config.

        **Not implemented yet** — placeholder for a first-class "export recipe" workflow.

        The idea: model owners publish an ``export_config.json`` (or an ``export_config`` field in
        ``config.json``) alongside their weights on the Hub. That file captures the settings the
        owner has already validated for their architecture — the target format (``dynamo`` /

View on GitHub (pinned to a597f97485)

Solutions

  1. Ensure the dict has a top-level 'export_format' key set to a fully registered name: 'dynamo', 'onnx', or 'executorch'.
  2. Pre-check with AutoHfExporter.supports_export_format(export_config_dict) — it returns False (and logs an actionable warning) instead of raising.
  3. If a custom format is half-registered, register both halves: @register_export_config(name) on an ExportConfigMixin subclass and @register_exporter(name) on an HfExporter subclass.
  4. If loading from JSON, verify the file schema contains "export_format" before calling from_config.

Example fix

# before
exporter = AutoHfExporter.from_config({"format": "onnx"})  # ValueError

# after
exporter = AutoHfExporter.from_config({"export_format": "onnx"})

# or guard first
if AutoHfExporter.supports_export_format(cfg_dict):
    exporter = AutoHfExporter.from_config(cfg_dict)
Defensive patterns

Strategy: validation

Validate before calling

from transformers.exporters.auto import AutoHfExporter

if not AutoHfExporter.supports_export_format(cfg_dict):
    # supports_export_format logs an actionable warning; fall back or fail gracefully
    raise SystemExit(f"export config not supported: {cfg_dict!r}")
exporter = AutoHfExporter.from_config(cfg_dict)

Type guard

def is_supported_export_config(cfg_dict: dict) -> bool:
    from transformers.exporters.auto import AutoHfExporter
    return AutoHfExporter.supports_export_format(cfg_dict)

Try / catch

try:
    exporter = AutoHfExporter.from_config(cfg)
except ValueError as e:
    if "Unsupported export config" in str(e):
        cfg["export_format"] = pick_backend()  # repair and retry once
        exporter = AutoHfExporter.from_config(cfg)
    else:
        raise

Prevention

When it happens

Trigger: Calling AutoHfExporter.from_config(cfg) where cfg lacks the 'export_format' key; where export_format is a typo/unregistered name; or passing a dict loaded from a JSON file that stores the format under a different key (e.g. 'format' or 'backend').

Common situations: Loading export_config.json from a hub checkpoint whose schema drifted; converting an ExportConfigMixin to a dict with to_dict() and then mutating it; a custom exporter registered via register_exporter but without a matching register_export_config (half-registered).

Related errors


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