InterGCN-ABSA icon indicating copy to clipboard operation
InterGCN-ABSA copied to clipboard

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation

Open ekgp908 opened this issue 3 years ago • 7 comments

Error occurs when performing the code below according to README.md's method

 CUDA_VISIBLE_DEVICES=1 python3 train.py --model_name intergcn --dataset rest14 --save True --learning_rate 1e-3 --seed 29 --batch_size 16

But when i runing it got this error:

Traceback (most recent call last):
  File "train.py", line 215, in <module>
    ins.run()
  File "train.py", line 144, in run
    max_test_acc, max_test_f1 = self._train(criterion, optimizer)
  File "train.py", line 78, in _train
    loss.backward()
  File "/home/dahye/venv_intergcn/lib/python3.6/site-packages/torch/tensor.py", line 102, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph)
  File "/home/dahye/venv_intergcn/lib/python3.6/site-packages/torch/autograd/__init__.py", line 90, in backward
    allow_unreachable=True)  # allow_unreachable flag
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation

Please help..

ekgp908 avatar Jul 16 '21 02:07 ekgp908

I'm very sorry. Have you ever tried to change the version of Pytorch to 1.0.0?

BinLiang-NLP avatar Jul 19 '21 08:07 BinLiang-NLP

Already pytorch version is 1.0.0. This is my environment.

Python 3.6.9
Pytorch 1.0.0
Spacy 2.0.18
Numpy 1.15.4

ekgp908 avatar Jul 20 '21 08:07 ekgp908

I have the same problem...

v-JiangNan avatar Nov 30 '21 09:11 v-JiangNan

Already pytorch version is 1.0.0. This is my environment.

Python 3.6.9
Pytorch 1.0.0
Spacy 2.0.18
Numpy 1.15.4

I'm very sorry. Since I won't meet this error when I run the code. Could you please tell me when did you meet this error?

BinLiang-NLP avatar Dec 02 '21 15:12 BinLiang-NLP

I have the same problem...

I'm very sorry. Since I won't meet this error when I run the code. Could you please tell me when did you meet this error?

BinLiang-NLP avatar Dec 02 '21 15:12 BinLiang-NLP

just change x += 0.2 * x_d to x = x + 0.2 * x_d In the model forward propagation code.this works for me

z1ouhan avatar Mar 21 '22 05:03 z1ouhan

nice , this works for me too

KokiaY avatar Mar 26 '22 07:03 KokiaY