{"record":{"id":"9d780e513f8f5917","repo":"huggingface/transformers","slug":"autohfexporter-from-pretrained-is-not-implemented","errorCode":null,"errorMessage":"AutoHfExporter.from_pretrained is not implemented yet. Load/export configs explicitly and call AutoHfExporter.from_config(...) instead.","messagePattern":"AutoHfExporter\\.from_pretrained is not implemented yet\\. Load/export configs explicitly and call AutoHfExporter\\.from_config\\(\\.\\.\\.\\) instead\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"src/transformers/exporters/auto.py","lineNumber":117,"sourceCode":"        owner has already validated for their architecture — the target format (``dynamo`` /\n        ``onnx`` / ``executorch``), exact dynamic-shape specs (e.g. ``text_ids`` dynamic to 4096,\n        image tiles fixed at 448, ``batch=1`` for edge deployment), ``strict`` flag, ONNX opset,\n        prefill vs. decode layout, ExecuTorch backend choice, and any other knob that today lives\n        as tribal knowledge in a README or a private notebook.\n\n        Consumers then get the owner-validated export in one call::\n\n            exporter = AutoHfExporter.from_pretrained(\"org/model-name\")\n            program = exporter.export(model, inputs)\n\n        Composes with the [`register_export_input_preparer`] registry: the owner supplies the\n        shape spec via ``export_config.json``, transformers supplies the data-dependent\n        precomputations (``cu_seqlens``, vision position ids, window indices, …) for that\n        architecture. Together they cover the two hard parts of exporting new models — knowing\n        the right shape contract and preparing the right inputs — so downstream users don't\n        re-derive either from scratch (and don't break in production when they get it wrong).\n        \"\"\"\n        raise NotImplementedError(\n            \"AutoHfExporter.from_pretrained is not implemented yet. \"\n            \"Load/export configs explicitly and call AutoHfExporter.from_config(...) instead.\"\n        )\n\n    @staticmethod\n    def supports_export_format(export_config_dict: dict) -> bool:\n        \"\"\"Return True if the provided dict describes an ``export_format`` that has both a\n        registered config class and a registered exporter class. Warns with an actionable message\n        when the format is missing entirely, unknown, or only half-registered.\"\"\"\n        export_fmt = export_config_dict.get(\"export_format\")\n        if export_fmt is None:\n            logger.warning(\n                \"No 'export_format' key in export config — supported values are: \"\n                f\"{sorted(AUTO_EXPORTER_MAPPING)}. Skipping.\"\n            )\n            return False\n\n        name = export_fmt.value if isinstance(export_fmt, ExportFormat) else export_fmt","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/huggingface/transformers/blob/a597f974857b3d92939971296bc0deb93d33d780/src/transformers/exporters/auto.py#L99-L135","documentation":"AutoHfExporter.from_pretrained is declared (with a docstring advertising loading an exporter from a checkpoint that ships an export config) but its body unconditionally raises NotImplementedError. The library does not yet auto-discover export configs on the hub, so you must build the config yourself and call AutoHfExporter.from_config().","triggerScenarios":"Calling AutoHfExporter.from_pretrained(\"org/model-name\") — always raises, regardless of arguments.","commonSituations":"Reading the class docstring or an example and assuming the one-call API works today; copy-pasting sample code from the from_pretrained docstring; exploring the API surface via dir()/autocomplete.","solutions":["Load or construct the export config explicitly and use AutoHfExporter.from_config(config) instead.","For a JSON file, do cfg = AutoExportConfig.from_dict(json.load(open(\"export_config.json\"))) then AutoHfExporter.from_config(cfg).","Track the transformers changelog — from_pretrained is planned but unimplemented at this version."],"exampleFix":"# before\nexporter = AutoHfExporter.from_pretrained(\"org/model-name\")  # NotImplementedError\n\n# after\nfrom transformers.exporters import AutoExportConfig, AutoHfExporter\ncfg = AutoExportConfig.from_dict({\"export_format\": \"onnx\", \"output_path\": \"model.onnx\"})\nexporter = AutoHfExporter.from_config(cfg)","handlingStrategy":"validation","validationCode":"from transformers.exporters import AutoExportConfig, AutoHfExporter\n\n# from_pretrained is a stub; build the config explicitly instead\ncfg = AutoExportConfig.from_dict({\"export_format\": \"onnx\"})\nexporter = AutoHfExporter.from_config(cfg)","typeGuard":null,"tryCatchPattern":"try:\n    exporter = AutoHfExporter.from_pretrained(repo_id)\nexcept NotImplementedError:\n    cfg = AutoExportConfig.from_dict({\"export_format\": \"onnx\"})\n    exporter = AutoHfExporter.from_config(cfg)","preventionTips":["Do not call AutoHfExporter.from_pretrained — check its status in the changelog each release","Keep an explicit config-construction helper in your codebase so the future migration is one-line"],"tags":["export","not-implemented","auto-class"],"backgroundTag":null,"analyzedSha":"a597f974857b3d92939971296bc0deb93d33d780","analyzedAt":"2026-08-14T18:24:08.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}