huggingface/transformers · error · ValueError

Unknown exporter type, got {name} - supported exporters are:

Error message

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

What it means

Raised by AutoExportConfig.from_dict when the 'export_format' key of the config dict (given as a plain string or an ExportFormat enum) does not match any name registered in AUTO_EXPORT_CONFIG_MAPPING ('executorch', 'dynamo', 'onnx'). The error message lists the supported names so you can immediately see the valid options. It exists to stop an unsupported backend name from silently producing a wrong exporter.

Source

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

    The Auto-HF export config class that takes care of automatically dispatching to the correct
    export config given an export config stored in a dictionary.
    """

    @classmethod
    def from_dict(cls, export_config_dict: dict):
        export_format = export_config_dict.get("export_format")

        if export_format is None:
            raise ValueError("export_config_dict must contain key 'export_format' set to exporter name")

        # Allow passing an ExportFormat enum value or a plain string
        if isinstance(export_format, ExportFormat):
            name = export_format.value
        else:
            name = export_format

        if name not in AUTO_EXPORT_CONFIG_MAPPING:
            raise ValueError(
                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):

View on GitHub (pinned to a597f97485)

Solutions

  1. Use one of the registered names exactly as listed in the error: 'dynamo', 'onnx', or 'executorch' (lowercase).
  2. If you passed an ExportFormat enum, check its .value matches a registered key (print it: the mapping keys are in the error message).
  3. If you genuinely need a custom backend, register a config class first with @register_export_config("<name>") on a subclass of ExportConfigMixin.
  4. Validate the key before calling: from transformers.exporters.auto import AUTO_EXPORT_CONFIG_MAPPING; assert name in AUTO_EXPORT_CONFIG_MAPPING.

Example fix

# before
config = AutoExportConfig.from_dict({"export_format": "ONNX"})  # ValueError

# after
config = AutoExportConfig.from_dict({"export_format": "onnx"})
Defensive patterns

Strategy: type-guard

Validate before calling

from transformers.exporters.auto import AUTO_EXPORT_CONFIG_MAPPING

name = cfg_dict.get("export_format")
name = name.value if hasattr(name, "value") else name
if name not in AUTO_EXPORT_CONFIG_MAPPING:
    raise KeyError(f"unsupported export_format {name!r}; pick from {sorted(AUTO_EXPORT_CONFIG_MAPPING)}")

Type guard

def is_known_export_format(name) -> bool:
    from transformers.exporters.auto import AUTO_EXPORT_CONFIG_MAPPING
    return name in AUTO_EXPORT_CONFIG_MAPPING

Try / catch

try:
    cfg = AutoExportConfig.from_dict(d)
except ValueError as e:
    if "Unknown exporter type" in str(e):
        # read the supported list from the message, prompt user/backend choice
        raise
    raise

Prevention

When it happens

Trigger: Calling AutoExportConfig.from_dict({...}) with export_format set to a typo or unregistered backend, e.g. 'onnxruntime', 'tflite', 'trt', 'torchscript', or 'ONNX' (case-sensitive), or passing an ExportFormat enum whose .value is not a registered key.

Common situations: Migrating from the legacy transformers.onnx CLI names to the new exporters API; hand-writing an export_config.json for a checkpoint; typos and casing mismatches; expecting a backend that requires third-party registration via register_export_config().

Related errors


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