keras-team/keras · error · TypeError

Unable to revive model from config. When overriding the `get

Error message

Unable to revive model from config. When overriding the `get_config()` method, make sure that the returned config contains all items used as arguments in the  constructor to {cls}, which is the default behavior. You can override this default behavior by defining a `from_config(cls, config)` class method to specify how to create an instance of {cls.__name__} from its config.

Received config={config}

Error encountered during deserialization: {e}

What it means

Error "Unable to revive model from config. When overriding the `get_config()` method, make sure that the returned config contains all items used as arguments in the constructor to {cls}, which is the default behavior. You can override this default behavior by defining a `from_config(cls, config)` class method to specify how to create an instance of {cls.__name__} from its config. Received config={config} Error encountered during deserialization: {e}" thrown in keras-team/keras.

Source

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

            # Revive Functional model
            # (but not Functional subclasses with a custom __init__)
            from keras.src.models.functional import functional_from_config

            return functional_from_config(
                cls, config, custom_objects=custom_objects
            )

        # Either the model has a custom __init__, or the config
        # does not contain all the information necessary to
        # revive a Functional model. This happens when the user creates
        # subclassed models where `get_config()` is returning
        # insufficient information to be considered a Functional model.
        # In this case, we fall back to provide all config into the
        # constructor of the class.
        try:
            return cls(**config)
        except TypeError as e:
            raise TypeError(
                "Unable to revive model from config. When overriding "
                "the `get_config()` method, make sure that the "
                "returned config contains all items used as arguments "
                f"in the  constructor to {cls}, "
                "which is the default behavior. "
                "You can override this default behavior by defining a "
                "`from_config(cls, config)` class method to specify "
                "how to create an "
                f"instance of {cls.__name__} from its config.\n\n"
                f"Received config={config}\n\n"
                f"Error encountered during deserialization: {e}"
            )

    def _get_variable_map(self):
        store = {}
        map_saveable_variables(self, store=store, visited_saveables=set())
        return store

View on GitHub (pinned to 7a34a03db6)

When it happens

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