keras-team/keras · error · ValueError

Unsupported arguments for LiteRT export with the PyTorch…

Error message

Unsupported arguments for LiteRT export with the PyTorch backend: {', '.join(unsupported_args)}. Supported arguments are: {', '.join(supported_args)}.

What it means

Guard in the kwargs-filtering pass of the PyTorch-backend export path: after distributing kwargs into valid_litert_torch_args (and specially handling 'optimizations'), any leftover keyword is unsupported for the PyTorch backend and listed here along with the accepted argument names.

Solutions

  1. Remove the unsupported keyword arguments listed in the error from the export call
  2. Move the intended effect to a supported argument from the listed set (e.g., pass 'optimizations' instead of backend-specific quantization kwargs)
  3. Use quant_config built from 'optimizations' rather than passing TFLite-style converter flags directly
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at keras/src/export/litert.py:288 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of keras-team/keras@7a34a03db6 (2026-08-25). Data as JSON: /api/errors/410f0f79f72d09a7. Report an issue: GitHub.

Appendix: source

Thrown at keras/src/export/litert.py:288

    for k, v in kwargs.items():
        if k in valid_litert_torch_args:
            litert_torch_kwargs[k] = v

    if "optimizations" in kwargs and "quant_config" not in litert_torch_kwargs:
        quant_cfg = _create_quant_config_from_optimizations(
            kwargs["optimizations"], litert_torch
        )
        if quant_cfg is not None:
            litert_torch_kwargs["quant_config"] = quant_cfg

    unsupported_args = sorted(
        key
        for key in kwargs
        if key not in valid_litert_torch_args and key != "optimizations"
    )
    if unsupported_args:
        supported_args = sorted(valid_litert_torch_args | {"optimizations"})
        raise ValueError(
            "Unsupported arguments for LiteRT export with the PyTorch "
            f"backend: {', '.join(unsupported_args)}. Supported arguments "
            f"are: {', '.join(supported_args)}."
        )

    return litert_torch_kwargs


def _get_litert_torch_kwarg_names(litert_torch):
    return {
        name
        for name in inspect.signature(litert_torch.convert).parameters
        if name not in {"module", "sample_args", "sample_kwargs"}
    }


@contextlib.contextmanager
def _preserve_jax_x64_state():

View on GitHub (pinned to 7a34a03db6)