You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[29], line 1
----> 1 model.save(os.path.join(log_dir, 'model.h5'), save_format='h5')
File /opt/conda/lib/python3.10/site-packages/tensorflow/python/keras/engine/training.py:2132, in Model.save(self, filepath, overwrite, include_optimizer, save_format, signatures, options, save_traces)
2090 """Saves the model to Tensorflow SavedModel or a single HDF5 file.
2091
2092 Please see `tf.keras.models.save_model` or the
(...)
2129 ```
2130 """
2131 # pylint: enable=line-too-long
-> 2132 save.save_model(self, filepath, overwrite, include_optimizer, save_format,
2133 signatures, options, save_traces)
File /opt/conda/lib/python3.10/site-packages/tensorflow/python/keras/saving/save.py:145, in save_model(model, filepath, overwrite, include_optimizer, save_format, signatures, options, save_traces)
136 if (not model._is_graph_network and # pylint:disable=protected-access
137 not isinstance(model, sequential.Sequential)):
138 raise NotImplementedError(
139 'Saving the model to HDF5 format requires the model to be a '
140 'Functional model or a Sequential model. It does not work for '
(...)
143 'to the Tensorflow SavedModel format (by setting save_format="tf") '
144 'or using `save_weights`.')
--> 145 hdf5_format.save_model_to_hdf5(
146 model, filepath, overwrite, include_optimizer)
147 else:
148 with generic_utils.SharedObjectSavingScope():
File /opt/conda/lib/python3.10/site-packages/tensorflow/python/keras/saving/hdf5_format.py:110, in save_model_to_hdf5(model, filepath, overwrite, include_optimizer)
107 opened_new_file = False
109 try:
--> 110 model_metadata = saving_utils.model_metadata(model, include_optimizer)
111 for k, v in model_metadata.items():
112 if isinstance(v, (dict, list, tuple)):
File /opt/conda/lib/python3.10/site-packages/tensorflow/python/keras/saving/saving_utils.py:172, in model_metadata(model, include_optimizer, require_config)
161 logging.warning(
162 'TensorFlow optimizers do not '
163 'make it possible to access '
(...)
169 'Prefer using a Keras optimizer instead '
170 '(see keras.io/optimizers).')
171 elif model._compile_was_called: # pylint: disable=protected-access
--> 172 training_config = model._get_compile_args(user_metrics=False) # pylint: disable=protected-access
173 training_config.pop('optimizer', None) # Handled separately.
174 metadata['training_config'] = _serialize_nested_config(training_config)
TypeError: clone_and_build_model.<locals>.<lambda>() got an unexpected keyword argument 'user_metrics'
got error too when loading checkpoint which is saved model format, not h5 format.
code:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[34], line 5
----> 5 reloaded = tf.keras.models.load_model(model_path,
6 custom_objects=custom_objects)
File /opt/conda/lib/python3.10/site-packages/keras/utils/traceback_utils.py:70, in filter_traceback.<locals>.error_handler(*args, **kwargs)
67 filtered_tb = _process_traceback_frames(e.__traceback__)
68 # To get the full stack trace, call:
69 # `tf.debugging.disable_traceback_filtering()`
---> 70 raise e.with_traceback(filtered_tb) from None
71 finally:
72 del filtered_tb
File /opt/conda/lib/python3.10/site-packages/keras/saving/legacy/saved_model/load.py:358, in KerasObjectLoader._add_children_recreated_from_config(self, obj, proto, node_id)
356 obj._maybe_initialize_trackable()
357 if isinstance(obj, base_layer.Layer) and not obj.built:
--> 358 metadata = json_utils.decode(self._metadata[node_id].metadata)
359 self._try_build_layer(
360 obj, node_id, metadata.get("build_input_shape")
361 )
363 # Create list of all possible children
KeyError: 808
Operating environment(运行环境):
python version [e.g. 3.10.12]
tensorflow version [e.g. 2.11.0]
deepctr version [e.g. 0.9.3]
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Describe the bug(问题描述)
code:
stack trace:
code:
stack trace
Operating environment(运行环境):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: