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

.backward not working due to in-place ops? #6

Open
nimasadri11 opened this issue May 27, 2022 · 1 comment
Open

.backward not working due to in-place ops? #6

nimasadri11 opened this issue May 27, 2022 · 1 comment

Comments

@nimasadri11
Copy link

Hi there, I try to train the model, but it gives me the following error:

Traceback (most recent call last):
  File "scripts/train.py", line 188, in <module>
    main(args)
  File "scripts/train.py", line 168, in main
    trainer.train(args.start_iter, args.end_iter)
  File "/home/user/train_engine.py", line 137, in train
    self.run_step()
  File "train.py", line 72, in run_step
    print(loss_dict)
  File "/home/user/.local/lib/python3.8/site-packages/torch/_tensor.py", line 363, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
  File "/home/user/.local/lib/python3.8/site-packages/torch/autograd/__init__.py", line 173, in backward
    Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the backward pass
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.HalfTensor [16, 512, 128, 128]], which is output 0 of ReluBackward0, is at version 1; expected version 0 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later. Good luck!
@dingmyu
Copy link
Owner

dingmyu commented May 29, 2022

Hi, could you locate the line that contains the issue?

I didn't encounter this problem, I'm guessing it might be because of PyTorch versions?

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