-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Video transformers - added fixes to enable model load after saving and added HF model & space #1015
base: master
Are you sure you want to change the base?
Video transformers - added fixes to enable model load after saving and added HF model & space #1015
Conversation
added HF model & space links
@@ -279,6 +293,17 @@ def call(self, inputs, mask=None): | |||
proj_output = self.dense_proj(proj_input) | |||
return self.layernorm_2(proj_input + proj_output) | |||
|
|||
def get_config(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added to fix loading of model after saving.
|
||
""" | ||
Now, we can create a subclassed layer for the Transformer. | ||
""" | ||
|
||
|
||
@tf.keras.utils.register_keras_serializable(package="Custom", name="TransformerEncoder") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this to avoid passing custom_objects dict to tf.keras.models.load_model()
Hi @fchollet, would be great if you could take a quick look at this PR whenever you find the time. It has minimal suggested changes. |
Thanks! Please remove serialization support, it is not needed for this example and it adds complexity to the code example. If you want to reload a saved model, please use |
Hi @fchollet , makes sense. I had initially added that because I was trying to load the model for inference in a separate script where I didn't have access to the model's code. Have removed the serialization support now. Let me know if you'd like me to fix anything else. |
@fchollet Can you have a look at this? |
Hi, I have updated the video transformers example with links to model & space on Hugging Face hub.
While trying to save and re-load the model, I faced few errors. Have added the fixes for those as well.