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: Node 'conv_high_res_0' resp. TypeError: conv2d(): argument 'padding' #12

Open
stvogel opened this issue Feb 6, 2022 · 6 comments

Comments

@stvogel
Copy link

stvogel commented Feb 6, 2022

Thanks for providing your code for FastFlow.
I try to train it but I got the following error:

Traceback (most recent call last):
  File "./FastFlow/FrEIA/framework/graph_inn.py", line 300, in forward
    mod_out = node.module(mod_in, rev=rev, jac=jac)
  File "~/.pyenv/versions/3.8.12/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "./FastFlow/FrEIA/modules/all_in_one_block.py", line 248, in forward
    a1 = self.subnet(x1c)
  File "~/.pyenv/versions/3.8.12/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "~/.pyenv/versions/3.8.12/lib/python3.8/site-packages/torch/nn/modules/container.py", line 119, in forward
    input = module(input)
  File "~/.pyenv/versions/3.8.12/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "~/.pyenv/versions/3.8.12/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 399, in forward
    return self._conv_forward(input, self.weight, self.bias)
  File "~/.pyenv/versions/3.8.12/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 395, in _conv_forward
    return F.conv2d(input, weight, bias, self.stride,
TypeError: conv2d(): argument 'padding' (position 5) must be tuple of ints, not str

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "main.py", line 29, in <module>
    model = train(train_loader, test_loader)
  File "./FastFlow/train.py", line 86, in train
    z, log_jac_det = model(inputs)
  File "~/.pyenv/versions/3.8.12/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "./FastFlow/model.py", line 133, in forward
    z, log_jac_det = self.nf(feat_s)
  File "~/.pyenv/versions/3.8.12/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "./FastFlow/FrEIA/framework/graph_inn.py", line 302, in forward
    raise RuntimeError(f"{node} encountered an error.") from e
RuntimeError: Node 'conv_high_res_0': [(24, 24, 768)] -> AllInOneBlock -> [(24, 24, 768)] encountered an error.

I'm not sure what's the error here. I assumed it was the padding-problem (which was a problem between version of torch before 1.8)
I'm using torch 1.8 but I cannot find any padding-problems.

Did someone else got this error?

@AlessioGalluccio
Copy link
Owner

Hi @stvogel,
I use torch 1.10.0 and I never got that error. Did you modify the code in some way? If there is a way to solve this issue, I'm ready to fix the code.
Best,
Alessio

@stvogel
Copy link
Author

stvogel commented Feb 8, 2022

Hi @AlessioGalluccio,

ahh torch 1.10.0 did the trick. Thanks a lot for your hint.
Maybe this version should be added to the requirements.txt.

@AlessioGalluccio
Copy link
Owner

That's a great idea. I updated it. Thank you very much.
Best,
Alessio

@gaowq2017
Copy link

Hi @AlessioGalluccio,
I haven't update the version of torch and the code can run. The detial as follow:

image
Only change this way.

@Wangj688
Copy link

Wangj688 commented Apr 3, 2022

hi, i can't find the file to modify

@hondazeon
Copy link

hondazeon commented Apr 18, 2022

Hi, @Wangj688
The code fragment @gaowq2017 mentioned is in model.py. It worked fine with torch1.8.2 on windows10.

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

5 participants