hiyoung123/SoftMaskedBert

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

qq596588073 opened this issue · 4 comments

Start train 0 ford
Calling BertTokenizer.from_pretrained() with the path to a single file or url is deprecated
{'epoch': 0, 'iter': 0, 'avg_loss': 8.148957252502441, 'avg_acc': 0.0, 'loss': 8.148957252502441}
EP_train:0: 0% 1/1723 [00:36<17:17:03, 36.13s/it]Traceback (most recent call last):
File "train.py", line 182, in
trainer.train(train_data_loader, e)
File "train.py", line 33, in train
return self.iteration(epoch, train_data)
File "train.py", line 79, in iteration
loss.backward(retain_graph=True)
File "/usr/local/lib/python3.6/dist-packages/torch/tensor.py", line 198, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/usr/local/lib/python3.6/dist-packages/torch/autograd/init.py", line 100, in backward
allow_unreachable=True) # allow_unreachable flag
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [768]] is at version 3; expected version 2 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).
EP_train:0: 0% 1/1723 [01:10<33:33:36, 70.16s/it]
一直出现这个问题,请问您有什么好的解决办法嘛

你好,请问可以分享以下数据集吗

你好,请问可以分享以下数据集吗

我的名字就是我的qq,加我发给你

Start train 0 ford
Calling BertTokenizer.from_pretrained() with the path to a single file or url is deprecated
{'epoch': 0, 'iter': 0, 'avg_loss': 8.148957252502441, 'avg_acc': 0.0, 'loss': 8.148957252502441}
EP_train:0: 0% 1/1723 [00:36<17:17:03, 36.13s/it]Traceback (most recent call last):
File "train.py", line 182, in
trainer.train(train_data_loader, e)
File "train.py", line 33, in train
return self.iteration(epoch, train_data)
File "train.py", line 79, in iteration
loss.backward(retain_graph=True)
File "/usr/local/lib/python3.6/dist-packages/torch/tensor.py", line 198, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/usr/local/lib/python3.6/dist-packages/torch/autograd/init.py", line 100, in backward
allow_unreachable=True) # allow_unreachable flag
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [768]] is at version 3; expected version 2 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).
EP_train:0: 0% 1/1723 [01:10<33:33:36, 70.16s/it]
一直出现这个问题,请问您有什么好的解决办法嘛

请问问题解决了么?我也出了这个问题。在本地跑正常,服务器上就会报错。本地pytorch版本1.4.0,服务器1.5.0

Start train 0 ford
Calling BertTokenizer.from_pretrained() with the path to a single file or url is deprecated
{'epoch': 0, 'iter': 0, 'avg_loss': 8.148957252502441, 'avg_acc': 0.0, 'loss': 8.148957252502441}
EP_train:0: 0% 1/1723 [00:36<17:17:03, 36.13s/it]Traceback (most recent call last):
File "train.py", line 182, in
trainer.train(train_data_loader, e)
File "train.py", line 33, in train
return self.iteration(epoch, train_data)
File "train.py", line 79, in iteration
loss.backward(retain_graph=True)
File "/usr/local/lib/python3.6/dist-packages/torch/tensor.py", line 198, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/usr/local/lib/python3.6/dist-packages/torch/autograd/init.py", line 100, in backward
allow_unreachable=True) # allow_unreachable flag
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [768]] is at version 3; expected version 2 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).
EP_train:0: 0% 1/1723 [01:10<33:33:36, 70.16s/it]
一直出现这个问题,请问您有什么好的解决办法嘛

请问问题解决了么?我也出了这个问题。在本地跑正常,服务器上就会报错。本地pytorch版本1.4.0,服务器1.5.0

这个我一直没有解决,我一直没有运行出来