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

AssertionError: Wrong size for dimension 1: got 6, expected 8 #34

Open
MKattaa opened this issue Feb 11, 2024 · 1 comment
Open

AssertionError: Wrong size for dimension 1: got 6, expected 8 #34

MKattaa opened this issue Feb 11, 2024 · 1 comment

Comments

@MKattaa
Copy link

MKattaa commented Feb 11, 2024

How many image views are required for model training?
When running the training script, I get the following message:

-- Process 0 terminated with the following error:
Traceback (most recent call last):
File "/opt/conda/envs/pix2pix3d/lib/python3.9/site-packages/torch/multiprocessing/spawn.py", line 68, in _wrap
fn(i, *args)
File "/workspaces/3d_nlp/pix2pix3D/train.py", line 57, in subprocess_fn
training_loop.training_loop(rank=rank, **c)
File "/workspaces/3d_nlp/pix2pix3D/training/training_loop.py", line 331, in training_loop
misc.print_module_summary(D, [img, c])
File "/workspaces/3d_nlp/pix2pix3D/torch_utils/misc.py", line 230, in print_module_summary
outputs = module(*inputs)
File "/opt/conda/envs/pix2pix3d/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/envs/pix2pix3d/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1561, in _call_impl
result = forward_call(*args, **kwargs)
File "/workspaces/3d_nlp/pix2pix3D/training/dual_discriminator.py", line 165, in forward
x, img = block(x, img, **block_kwargs)
File "/opt/conda/envs/pix2pix3d/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/envs/pix2pix3d/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1561, in _call_impl
result = forward_call(*args, **kwargs)
File "/workspaces/3d_nlp/pix2pix3D/training/networks_stylegan2.py", line 623, in forward
misc.assert_shape(img, [None, self.img_channels, self.resolution, self.resolution])
File "/workspaces/3d_nlp/pix2pix3D/torch_utils/misc.py", line 97, in assert_shape
raise AssertionError(f'Wrong size for dimension {idx}: got {size}, expected {ref_size}')
AssertionError: Wrong size for dimension 1: got 6, expected 8

Could the issue stem from having only 6 image views in my dataset, or might there be other factors contributing to the problem?
Any assistance would be greatly appreciated.

@dunbar12138
Copy link
Owner

It's probably because the training set only has 6 images. You can try using a smaller batch size, e.g., 1 or 2, and disable multi-GPU training.

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

2 participants