-
Notifications
You must be signed in to change notification settings - Fork 19.4k
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
Unable to make two instances of the MobileNetV3 within the same model #19689
Comments
Thanks for the repro! Here's a smaller one:
I think when the layer or model name is hard-coded in a functional model (like it is here for MobileNetV3), it won't be auto-deduplicated. I think the fix here is to remove the hard-coded name. |
jeffcarp
pushed a commit
to jeffcarp/keras
that referenced
this issue
May 9, 2024
Fixes keras-team#19689 Opted to add a `model_name` arg to fix the issue since it's a similar pattern in other `keras.applications` models. An alternative way is to use `keras.src.utils.naming.uniquify` internally.
jeffcarp
pushed a commit
to jeffcarp/keras
that referenced
this issue
May 9, 2024
Fixes keras-team#19689 Opted to add a `model_name` arg to fix the issue since it's a similar pattern in other `keras.applications` models. An alternative way is to use `keras.src.utils.naming.uniquify` internally.
jeffcarp
pushed a commit
to jeffcarp/keras
that referenced
this issue
May 11, 2024
jeffcarp
pushed a commit
to jeffcarp/keras
that referenced
this issue
May 11, 2024
fchollet
pushed a commit
that referenced
this issue
May 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to use two distinct instances of mobilenet as sub-modules of one bigger model.
This is the error I receive.
ValueError: The name "MobilenetV3small" is used 2 times in the model. All operation names should be unique.
For some weird reason, Keras does not handle name uniqueness automatically, nor does it give you the option to specify model name.
I've tested it on MobileNetV3Small specifically, but I guess it's the case for all other models within the
applications
API.See the code in a colab notebook below:
https://colab.research.google.com/drive/11R7m0yULUPhlN52ligdsPK18Mh6vKUCq?usp=sharing
P.S. I've tried to interface with
_name
attribute for each layer of the model, but it gets even worse from there, as it renders you unable to save the model throwing even more errors at you.The text was updated successfully, but these errors were encountered: