keras-team/keras · error · ValueError

The `filters` argument must be a regex string, a list of reg

Error message

The `filters` argument must be a regex string, a list of regex strings, or a callable. Received: {type(filters)}

What it means

Error "The `filters` argument must be a regex string, a list of regex strings, or a callable. Received: {type(filters)}" thrown in keras-team/keras.

Source

Thrown at keras/src/models/model.py:576

                value_range=(-127, 127)
            ),
        )

        # Quantize with custom config
        model.quantize(config=config)
        ```
        """
        # Validate inputs.
        type_check = kwargs.pop("type_check", True)
        if kwargs:
            raise ValueError(
                "Unrecognized keyword arguments "
                f"passed to {self.__class__.__name__}: {kwargs}"
            )

        if filters is not None:
            if not isinstance(filters, (str, Callable, list, tuple)):
                raise ValueError(
                    "The `filters` argument must be a regex string, a list of "
                    "regex strings, or a callable. Received: "
                    f"{type(filters)}"
                )

        # `mode` and `config` arrive here already resolved to a concrete mode
        # string and `QuantizationConfig`, because `Layer.__new__` wraps
        # `quantize` with `quantize_wrapper`, which calls
        # `validate_and_resolve_config`.

        # For structure-aware modes (`gptq`/`awq`), resolve and validate the
        # layer structure *before* mutating any layer, and restrict
        # quantization to the layers covered by the structure. Resolving it
        # here (rather than after the mutation loop) guarantees that a
        # missing/invalid structure leaves the model completely untouched
        # instead of half-quantized (buffers allocated, dtype policies
        # swapped). Only structure-covered layers are calibrated afterwards;
        # quantizing any other layer would leave it uncalibrated, and its

View on GitHub (pinned to 7a34a03db6)

When it happens

Trigger: Thrown at keras/src/models/model.py:576 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/bc804ed111d449e2. Report an issue: GitHub.