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

Runtime Error in pytorch version #5

Open
Excelsiorly opened this issue Jan 5, 2021 · 0 comments
Open

Runtime Error in pytorch version #5

Excelsiorly opened this issue Jan 5, 2021 · 0 comments

Comments

@Excelsiorly
Copy link

Excelsiorly commented Jan 5, 2021

Hi, I've been learning your code implentented by pyTorch lately. After I finished installing the required packages and started running the code by using console :python RMeN_pytorch/train_RMeN.py,the error occurs:

Namespace(attention_mlp_layers=2, checkpoint_path=None, dataset='WN18RR', dropout=0.5, gate_style='memory', head_size=64, hidden_size=50, learning_rate=0.005, lmbda=0.1, lmbda2=0.01, memory_slots=1, mode='train', model_name='RMeN', nbatches=100, neg_num=1, num_epochs=400, num_heads=2, num_of_filters=100, optim='adagrad', save_steps=1000, test_file='', use_init=1, use_pos=1, valid_steps=100)
Writing to /home/jojo/PythonProjects/KGE/R-MeN/runs_RMeN

Input Files Path : ./benchmarks/WN18RR/
Test File Path : 
The toolkit is importing datasets.
The total of relations is 11.
The total of entities is 40943.
The total of train triples is 86835.
The total of test triples is 3134.
The total of valid triples is 3034.
Initializing training model...
Finish initializing
  0%|                                                                                                                     | 0/400 [00:00<?, ?it/s]/home/jojo/PythonProjects/KGE/R-MeN/RMeN_pytorch/relational_rnn_general.py:177: UserWarning: Output 0 of SplitWithSizesBackward is a view and is being modified inplace. This view is an output of a function that returns multiple views. Inplace operators on such views are being deprecated and will be forbidden starting from version 1.8. Consider using `unsafe_` version of the function that produced this view or don't modify this view inplace. (Triggered internally at  /pytorch/torch/csrc/autograd/variable.cpp:491.)
  q *= (self.key_size ** -0.5)
  0%|                                                                                                                     | 0/400 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "train_RMeN.py", line 139, in <module>
    con.training_model()
  File "/home/jojo/PythonProjects/KGE/R-MeN/RMeN_pytorch/Config.py", line 462, in training_model
    loss = self.train_one_step()
  File "/home/jojo/PythonProjects/KGE/R-MeN/RMeN_pytorch/Config.py", line 416, in train_one_step
    loss.backward()
  File "/home/jojo/anaconda3/envs/tf2/lib/python3.7/site-packages/torch/tensor.py", line 221, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph)
  File "/home/jojo/anaconda3/envs/tf2/lib/python3.7/site-packages/torch/autograd/__init__.py", line 132, 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.cuda.FloatTensor [1736, 2, 2, 192]], which is output 0 of PermuteBackward, is at version 1; expected version 0 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).

my torch version is 1.7.1 and python version is 3.7

Looking forward to your reply.

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

1 participant