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

RuntimeError: The size of tensor a (512) must match the size of tensor b (256) at non-singleton dimension 0 #91

Closed
chengkeng opened this issue Apr 11, 2021 · 4 comments

Comments

@chengkeng
Copy link

chengkeng commented Apr 11, 2021

I want to train a 256*256 data set model in Google, and the result shows that the subject is wrong.

Constructing networks...
Resuming from "./pretrained/network-snapshot-001814.pkl"
Traceback (most recent call last):
File "train.py", line 566, in
main() # pylint: disable=no-value-for-parameter
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 829, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "train.py", line 559, in main
subprocess_fn(rank=0, args=args, temp_dir=temp_dir)
File "train.py", line 408, in subprocess_fn
training_loop.training_loop(rank=rank, **args)
File "/content/drive/My Drive/colab-sg2-ada-pytorch/stylegan2-ada-pytorch/training/training_loop.py", line 158, in training_loop
misc.copy_params_and_buffers(resume_data[name], module, require_all=False)
File "/content/drive/My Drive/colab-sg2-ada-pytorch/stylegan2-ada-pytorch/torch_utils/misc.py", line 160, in copy_params_and_buffers
tensor.copy_(src_tensors[name].detach()).requires_grad_(tensor.requires_grad)
RuntimeError: The size of tensor a (512) must match the size of tensor b (256) at non-singleton dimension 0

The 512 mentioned in it, can't I train 256 data sets and models?
Thank you

@Chalet37
Copy link

@chengkeng Did u find the solution?

@chengkeng chengkeng reopened this Apr 15, 2021
@chengkeng
Copy link
Author

@chengkeng Did u find the solution?

Without a solution, I cannot use the 256256 model transfer learning to train the 256256 data set. I must use the 512512 model to transfer the learning to the 256256 data set. And 256256 checkpoints cannot continue training, and 512512 must be used to train 256*256. Why is this?

@oitoito
Copy link

oitoito commented Apr 19, 2021

I'm having the same problem. I want to transfer from 256x256 to 512x512. I've successfully done this for all lower-res pairs (32x32 -> 64x64 -> 128x128 -> 256x256), but I'm getting an error for 256x256->512x512. I have not tried 512x512->1024x1024 yet but will also check that.

Is there a solution and where can I find it?

@ageroul
Copy link

ageroul commented Apr 28, 2021

@chengkeng & @oitoito : Hi,
Are your datasets multi-labeled? I have the same problem BUT only with multi-labeled set.
I opened an issue about it: https://github.com/NVlabs/stylegan2-ada-pytorch/issues/98

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

4 participants