RuntimeError: Legacy autograd function with non-static forward method is deprecated.
Please use new-style autograd function with static forward method. (Example: https://pytorch.org/docs/stable/autograd.html#torch.autograd.Function)
I followed the instructions from the provided link and added @staticmethod to the forward function. I now get a new error regarding the number of parameters in the model(data[0], target[0], inference=True) call at line 374 of main.py.
I tried several solutions:
Explicitly call `model.forward(data[0], target[0], inference=True)
This did not work and returned the error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/$HOME/.local/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 166, in forward
return self.module(*inputs[0], **kwargs[0])
File "/home/$HOME/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
TypeError: forward() missing 1 required positional argument: 'target'
I then tried to name the parameters that are defined in the forward call from the model ModelAndLoss like so: model.forward(data=data[0], target=target[0], inference=True)
I then received the following error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/$HOME/.local/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 166, in forward
return self.module(*inputs[0], **kwargs[0])
File "/home/$HOME/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
TypeError: forward() missing 1 required positional argument: 'self'
This implies that the object call to its own instance is required somehow in order to make this a valid call, so I tried:
model.forward(self=model, data=data[0], target=target[0], inference=True) and this then returned the error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: forward() got multiple values for argument 'self'
I am at a lost of ideas, any recommendations on how to fix this would be greatly appreciated.
To add some more references, I used the changes made in the pull request in #254 in order to install the custom layers, as my compiler is c++14.
Besides this, I have not made any other changes. Any maintainers help would be greatly appreciated!!
Hello, I am attempting to run the inference using the model. I run the provided command of
I get an error at line 374 of main.py
I followed the instructions from the provided link and added
@staticmethod
to the forward function. I now get a new error regarding the number of parameters in themodel(data[0], target[0], inference=True)
call at line 374 of main.py.I tried several solutions:
ModelAndLoss
like so:model.forward(data=data[0], target=target[0], inference=True)
I then received the following error:This implies that the object call to its own instance is required somehow in order to make this a valid call, so I tried:
model.forward(self=model, data=data[0], target=target[0], inference=True)
and this then returned the error:I am at a lost of ideas, any recommendations on how to fix this would be greatly appreciated.
To add some more references, I used the changes made in the pull request in #254 in order to install the custom layers, as my compiler is c++14.
Besides this, I have not made any other changes. Any maintainers help would be greatly appreciated!!
Thank you