BinLiang-NLP / InterGCN-ABSA

[COLING 2020] Jointly Learning Aspect-Focused and Inter-Aspect Relations with Graph Convolutional Networks for Aspect Sentiment Analysis
https://www.aclweb.org/anthology/2020.coling-main.13/
53 stars 6 forks source link

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

Open ekgp908 opened 2 years ago

ekgp908 commented 2 years ago

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..

BinLiang-NLP commented 2 years ago

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

ekgp908 commented 2 years ago

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
v-JiangNan commented 2 years ago

I have the same problem...

BinLiang-NLP commented 2 years ago

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 commented 2 years ago

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?

z1ouhan commented 2 years ago

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

KokiaY commented 2 years ago

nice , this works for me too