Skip to content
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

Cannot load model weights in inspect_model.ipynb #4

Open
jrclimer opened this issue Mar 1, 2023 · 0 comments
Open

Cannot load model weights in inspect_model.ipynb #4

jrclimer opened this issue Mar 1, 2023 · 0 comments

Comments

@jrclimer
Copy link

jrclimer commented Mar 1, 2023

I am trying to use inspect_model.ipynb without re-fitting the model. I updated weight_dir correctly, but get the following error:

`---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_25532\1426264973.py in
7 # # Load example weights stored on github
8 weight_dir = options.save_dir + '/example_trained_weights.npy'
----> 9 load_trained_weights(model, trainer, weight_dir)

...\grid-pattern-formation\utils.py in load_trained_weights(model, trainer, weight_dir)
129 # Load weights from npy array
130 weights = np.load(weight_dir, allow_pickle=True)
--> 131 model.RNN.set_weights(weights)
132 print('Loaded trained weights.')
133

~\anaconda3\envs\gfp\lib\site-packages\torch\nn\modules\module.py in getattr(self, name)
1267 if name in modules:
1268 return modules[name]
-> 1269 raise AttributeError("'{}' object has no attribute '{}'".format(
1270 type(self).name, name))
1271

AttributeError: 'RNN' object has no attribute 'set_weights'`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant