-
Notifications
You must be signed in to change notification settings - Fork 19.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple issue with mobilevit vision example while conversion to Keras 3 with TF backend #18613
Comments
Currently, model.save('my_model.keras') # (recommended)
model.save('my_model.h5') # lagecy and will be deprecated both are supported but it's warned that model.save_weight('my_model.weights.h5`) but in tf.keras, it was model.save_weight('my_model.h5`) Confusing a bit, hopefully will sort out soon. I tried to load a |
I am able to resolve |
@pksX01 , Could you track the RAM usage in colab, crash might be due to OOM issue. |
I guess so, CPU consumption is getting reached to peak and then colab crashes. |
Well in that case, it is related to the memory availability in your system, since colab offers only limited RAM capacity for free version. |
But it's creating in Kaggle as well which provides almost 30 GB RAM for CPU. |
Now, it didn't crash. I will open PR with the solutions/ modifications for the 5 issues mentioned in 1st comment in upcoming days. |
Since PR is merged now, I think we can close this issue. |
Working on converting the A mobile-friendly Transformer-based model for image classification keras.io example to keras 3 with TF backend and found multiple issues. Logging here as per #18468.
Issue 1: tensorflow_addons package is imported but not being used. This line itself is causing error when I am running in local on macbook air m1. But not causing error in running on google colab.
Issue 2: Issue in tf.nn.swish()
Issue 2 can be reproduced here.
Solution I tried: I replaced tf.nn.swish() with keras.activations.swish() and moved further to run notebook. This solution can be seen in notebook link of last issue.
Issue 3:
AttributeError: module 'keras.applications.imagenet_utils' has no attribute 'correct_pad'
This can be reproduced here.
Solution I tried: Removed
padding=imagenet_utils.correct_pad(m, 3)
fromlayers.ZeroPadding2D()
. This solution can be seen in notebook link of last issue.Issue 4: Issue in checkpoint-
ValueError: The filename must end in `.weights.h5`. Received: filepath=/tmp/checkpoint
This can be reproduced here
Solution I tried: Replaced
checkpoint_filepath = "/tmp/checkpoint"
withcheckpoint_filepath = "/tmp/checkpoint.weights.h5"
. This solution can be seen in notebook link of last issue.Issue 5: Issue while saving keras model for TFLite conversion. I got below error:
ValueError: Invalid filepath extension for saving. Please add either a `.keras` extension for the native Keras format (recommended) or a `.h5` extension. Use `tf.saved_model.save()` if you want to export a SavedModel for use with TFLite/TFServing/etc. Received: filepath=mobilevit_xxs.
When I tried to save using
.keras
extension but got below error:OSError: SavedModel file does not exist at: mobilevit_xxs.keras/{saved_model.pbtxt|saved_model.pb}
When I tried to save using
.h5
extension, I got below error:ValueError: Unable to create dataset (name already exists)
Issue 5 can be reproduced here.
The text was updated successfully, but these errors were encountered: