admin管理员组

文章数量:1400566

I trained a tensorflow ConvNeXtTiny model (tf.keras.applications.convnext.ConvNeXtTiny). I am able to train the model without any issues. But when I try to save the model with model.save(my_model, save_format="tf") I get the following error:

Traceback (most recent call last):
tensorflow-1  |   File "training_classifier.py", line 12, in <module>
tensorflow-1  |     model.save("my_model", save_format="tf")
tensorflow-1  |   File "/usr/local/lib/python3.8/dist-packages/keras/src/utils/traceback_utils.py", line 70, in error_handler
tensorflow-1  |     raise e.with_traceback(filtered_tb) from None
tensorflow-1  |   File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/trackable/trackable_utils.py", line 126, in escape_local_name
tensorflow-1  |     return (name.replace(_ESCAPE_CHAR, _ESCAPE_CHAR + _ESCAPE_CHAR).replace(
tensorflow-1  | AttributeError: 'NoneType' object has no attribute 'replace'

I did not make any modifications to the model.

This error occurs while trying to save the model both before and after training.

I don't get the error when I save in the h5 format. I don't get this error with other models of tensorflow like Resnet, EfficientNet, etc, but I get it with all sizes of ConvNeXt.

From what I have understood so far, people have only faced this issue when training custom models.

Is there any modification I can do to avoid this error and save my model in the tf format? This is the only format acceptable for me.

本文标签: tensorflow20Unable to save tensorflow ConvNeXtTiny model in tf format (TF 2130)Stack Overflow