Hi,
We are facing issues in loading a model which was trained with an earlier version of Autokeras.
We trained our model using, 1.1.0 (most possibly otherwise 1.0.20)
Tensorflow TF: 2.8
Python: 3.8/3.9
We tarined our model like this,
"import autokeras as ak
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X_t_v, y_t_v, test_size=0.2)#, random_state=42)
regressor = ak.StructuredDataRegressor(
overwrite=True,
max_trials=200 # Number of different models to try
)
"
We saved our model like this,
model.save("TRAINED/best_model_autokeras", save_format='tf')
in best_model_autokeras we have these files,
assets fingerprint.pb keras_metadata.pb saved_model.pb variables
And we are now trying load our model like this,
from keras.models import load_model
import autokeras as ak
model_newscaled = load_model('TRAINED/best_model_autokeras/')
showing this error,
"---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[3], line 1
----> 1 model_newscaled = load_model('best_model_autokeras/')
File ~/miniconda3/envs/autokeras3/lib/python3.8/site-packages/keras/utils/traceback_utils.py:67, in filter_traceback.<locals>.error_handler(*args, **kwargs)
65 except Exception as e: # pylint: disable=broad-except
66 filtered_tb = _process_traceback_frames(e.__traceback__)
---> 67 raise e.with_traceback(filtered_tb) from None
68 finally:
69 del filtered_tb
File ~/miniconda3/envs/autokeras3/lib/python3.8/site-packages/keras/saving/saved_model/load.py:532, in KerasObjectLoader._revive_layer_or_model_from_config(self, metadata, node_id)
530 builtin_layer = layers_module.get_builtin_layer(class_name)
531 if builtin_layer:
--> 532 raise RuntimeError(
533 f'Unable to restore object of class \'{class_name}\' likely due to '
534 f'name conflict with built-in Keras class \'{builtin_layer}\'. To '
535 'override the built-in Keras definition of the object, decorate '
536 'your class with `@keras.utils.register_keras_serializable` and '
537 'include that file in your program, or pass your class in a '
538 '`keras.utils.CustomObjectScope` that wraps this load call.') from e
539 else:
540 raise
RuntimeError: Unable to restore object of class 'Normalization' likely due to name conflict with built-in Keras class '<class 'keras.layers.preprocessing.normalization.Normalization'>'. To override the built-in Keras definition of the object, decorate your class with `@keras.utils.register_keras_serializable` and include that file in your program, or pass your class in a `keras.utils.CustomObjectScope` that wraps this load call.
"
Can you please help me with this issue? We have an article that is under review, and we need to rerun an experiment but we are struggling with this issue. Any help would be much appreciated. Thank you.
Best regards,
Deep Banerjee
Plymouth Marine Laboratory, UK
Hi,
We are facing issues in loading a model which was trained with an earlier version of Autokeras.
We trained our model using, 1.1.0 (most possibly otherwise 1.0.20)
Tensorflow TF: 2.8
Python: 3.8/3.9
We tarined our model like this,
We saved our model like this,
model.save("TRAINED/best_model_autokeras", save_format='tf')in best_model_autokeras we have these files,
assets fingerprint.pb keras_metadata.pb saved_model.pb variables
And we are now trying load our model like this,
showing this error,
Can you please help me with this issue? We have an article that is under review, and we need to rerun an experiment but we are struggling with this issue. Any help would be much appreciated. Thank you.
Best regards,
Deep Banerjee
Plymouth Marine Laboratory, UK