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

failed to train encoder #1

Open
seven7777777 opened this issue Sep 27, 2024 · 2 comments
Open

failed to train encoder #1

seven7777777 opened this issue Sep 27, 2024 · 2 comments

Comments

@seven7777777
Copy link

Traceback (most recent call last):
File "/home/notebook/code/group/benny/modflows/./train_encoder_v2.py", line 124, in
trained_model.load_state_dict(trained_param)
File "/opt/conda/lib/python3.9/site-packages/torch/nn/modules/module.py", line 2041, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for NeuralODE:
size mismatch for layer_1.weight: copying a param with shape torch.Size([64, 4]) from checkpoint, the shape in current model is torch.Size([1024, 4]).
size mismatch for layer_1.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for layer_2.weight: copying a param with shape torch.Size([3, 64]) from checkpoint, the shape in current model is torch.Size([3, 1024]).

@seven7777777
Copy link
Author

hi, i pre train data with generate_flows_v2.py, then trained encoder with train_encoder_v2.py. I got message like:

Traceback (most recent call last):
File "/home/notebook/code/group/benny/modflows/./train_encoder_v2.py", line 124, in
trained_model.load_state_dict(trained_param)
File "/opt/conda/lib/python3.9/site-packages/torch/nn/modules/module.py", line 2041, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for NeuralODE:
size mismatch for layer_1.weight: copying a param with shape torch.Size([64, 4]) from checkpoint, the shape in current model is torch.Size([1024, 4]).
size mismatch for layer_1.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for layer_2.weight: copying a param with shape torch.Size([3, 64]) from checkpoint, the shape in current model is torch.Size([3, 1024]).

@maria-larchenko what to do with train_encoder script then? thanks.

@seven7777777
Copy link
Author

I worked it out. In generate_flows_v2.py, hidden is 64, but it's 1024 in train_encoder_v2.py @seven7777777 @maria-larchenko

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