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: mat1 dim 1 must match mat2 dim 0 #2

Open
royaloctave opened this issue Oct 28, 2021 · 1 comment
Open

RuntimeError: mat1 dim 1 must match mat2 dim 0 #2

royaloctave opened this issue Oct 28, 2021 · 1 comment

Comments

@royaloctave
Copy link

Hi,

Thank you for the great work. I tried to do the inference on an image with resolution 1024*1024 using the following command
python main.py manipulate --model-name overlord-ffhq-x256-age --img face.png --output face_in_all_ages.png

but I get the following error:

Traceback (most recent call last): File "main.py", line 98, in <module> main() File "main.py", line 92, in main args.func(args) File "main.py", line 59, in manipulate manipulated_img = model.manipulate_by_labels(img) File "/home/userid2891/anaconda3/envs/overlord/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/home/userid2891/drive/projects/overlord/network/training.py", line 446, in manipulate_by_labels manipulated_img = self.amortized_model.generator(latent_code.unsqueeze(dim=0))[0] File "/home/userid2891/anaconda3/envs/overlord/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/userid2891/anaconda3/envs/overlord/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 167, in forward outputs = self.parallel_apply(replicas, inputs, kwargs) File "/home/userid2891/anaconda3/envs/overlord/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 177, in parallel_apply return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)]) File "/home/userid2891/anaconda3/envs/overlord/lib/python3.7/site-packages/torch/nn/parallel/parallel_apply.py", line 86, in parallel_apply output.reraise() File "/home/userid2891/anaconda3/envs/overlord/lib/python3.7/site-packages/torch/_utils.py", line 429, in reraise raise self.exc_type(msg) RuntimeError: Caught RuntimeError in replica 0 on device 0. Original Traceback (most recent call last): File "/home/userid2891/anaconda3/envs/overlord/lib/python3.7/site-packages/torch/nn/parallel/parallel_apply.py", line 61, in _worker output = module(*input, **kwargs) File "/home/userid2891/anaconda3/envs/overlord/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/userid2891/drive/projects/overlord/network/modules.py", line 76, in forward out = self.conv1(out, latent_code[:, 0]) File "/home/userid2891/anaconda3/envs/overlord/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/userid2891/drive/projects/overlord/network/modules.py", line 139, in forward out = self.conv(input, style) File "/home/userid2891/anaconda3/envs/overlord/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/userid2891/drive/projects/stylegan2-pytorch/model.py", line 258, in forward style = self.modulation(style).view(batch, 1, in_channel, 1, 1) File "/home/userid2891/anaconda3/envs/overlord/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/userid2891/drive/projects/stylegan2-pytorch/model.py", line 158, in forward input, self.weight * self.scale, bias=self.bias * self.lr_mul File "/home/userid2891/anaconda3/envs/overlord/lib/python3.7/site-packages/torch/nn/functional.py", line 1753, in linear return torch._C._nn.linear(input, weight, bias) RuntimeError: mat1 dim 1 must match mat2 dim 0

Can you please guide me how can I solve this issue?
Also to download the CelebA dataset from google drive https://drive.google.com/open?id=0B7EVK8r0v71pWEZsZE9oNnFzTm8 it requires permission. Can you please make it public?
Thank you in advance.

@avivga
Copy link
Owner

avivga commented Oct 28, 2021

Hello,
Thanks for your interest in our work.

  1. The inference assumes an input image of size 256x256. Please try to downscale the image before running the inference.
    Btw, if you only want to play with the facial age editing on external images of your choice, you may checkout our live demo on Replicate.ai: https://replicate.ai/avivga/overlord.

  2. I am not the owner of CelebA. In any case, I think you only need a valid google account to download it from google drive.

Good luck!

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