-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
sonnet abstract module in tensorflow2 #271
Comments
Hi @creativesh , |
Hi @tomhennigan Could I rewrite it to use tf2 ? |
Thanks
How should I convert it to tf2 ?
It is an i3d model. for action recognition
I have some weights in .ckpt format which is in tf1 format and want to load them in a model and retrain the model
…On Sat, Sep 30, 2023 at 3:37 PM Tom Hennigan ***@***.***> wrote:
Hi @creativesh <https://github.com/creativesh> , snt.AbstractModule is
part of Sonnet 1, it looks like the code you are wanting to run will only
work with TF1 not TF2.
—
Reply to this email directly, view it on GitHub
<#271 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFOLMRPAVS434CME24IOEZDX5ADQNANCNFSM6AAAAAA5NNGEJ4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hi, it should be possible to implement this in TF2/Sonnet 2, but this will require learning and understanding Sonnet 2. If you just want to make use of a pretrained I3D model then perhaps using Keras + TF2 would be simpler, they have an example that includes using I3D and some pretrained weights to make predictions for a video: https://www.tensorflow.org/hub/tutorials/action_recognition_with_tf_hub |
Thanks for your response, I have written the tf1 version of finetune code. now I want to write it in tf2. |
I am not very familiar with Keras, I would suggest asking for support on their issue tracker, hopefully someone will have a recipe for you. There is a generic guide on migrating checkpoints here which you could try to follow https://www.tensorflow.org/guide/migrate/migrating_checkpoints |
Do you have any sample code of developing networks with sonnet 2 and tensorflow 2 ? |
There are a number of examples here: https://github.com/google-deepmind/sonnet/tree/v2/examples |
In this post #128 would you please tell me exactly what to do about i3d.py in this link: 1- converting snt.AbstractModule to snt.Module |
Hi, the comment you linked to has information on how to port code from sonnet 1 -> 2 and what has changed between the libraries. Good luck with porting the code for your project. |
Hello friends
I want to use i3d model created by sonnet in tensorflow 2
these are my environment:
ubuntu 20
tensorflow 2.12
python 3.8
this is my i3d code:
`
from future import absolute_import
from future import division
from future import print_function
import sonnet as snt
import tensorflow as tf
class Unit3D(snt.AbstractModule):
`
but when I want to import it in tf2, I face the following error:
AttributeError: module 'sonnet' has no attribute 'AbstractModule'
which is related to this line:
class Unit3D(snt.AbstractModule):
>>> class MultiplyModule(snt.Module):
... def call(self, x):
... if not hasattr(self, 'w'):
... self.w = tf.Variable(2., name='w')
... return x * self.w
how to fix it ?
The text was updated successfully, but these errors were encountered: