def __setstate__(self, state: dict[str, Any]) -> None:
        """
        Use to ensure `KerasRegressor` can be unpickled.

        :param state: State dictionary with instance parameters to restore.
        """
        self.__dict__.update(state)

        if self.is_tensorflow:
            from tensorflow.keras.models import load_model
        else:
            from keras.models import load_model

        full_path = os.path.join(config.ART_DATA_PATH, state["model_name"])
        model = load_model(str(full_path))

        self._model = model
        self._initialize_params(model, state["_input_layer"], state["_output_layer"])

        Use to ensure `KerasRegressor` can be unpickled.

        :param state: State dictionary with instance parameters to restore.
        
art/estimators/regression/keras.py