lipiji / TranSummar

Transformer for abstractive summarization on cnn/daily-mail and gigawords
MIT License
140 stars 20 forks source link

Train Error: RuntimeError: Output 0 of SplitBackward0 is a view and is being modified inplace. #19

Closed zhongxiangboy closed 1 year ago

zhongxiangboy commented 2 years ago

while Training: python -u main.py | tee train.log

Traceback (most recent call last): File "main.py", line 534, in run(existing_model_name) File "main.py", line 470, in run batch.max_ext_len) File "/home/lpc/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, kwargs) File "/home/lpc/PycharmProjects/TranSummar-master/model.py", line 139, in forward hs, src_paddingmask = self.encode(x) File "/home/lpc/PycharmProjects/TranSummar-master/model.py", line 102, in encode x, ,_ = layer(x, self_padding_mask=padding_mask) File "/home/lpc/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, *kwargs) File "/home/lpc/PycharmProjects/TranSummar-master/transformer.py", line 36, in forward x, self_attn = self.self_attn(query=x, key=x, value=x, key_padding_mask=self_padding_mask, attn_mask=self_attn_mask, need_weights = need_weights) File "/home/lpc/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(input, kwargs) File "/home/lpc/PycharmProjects/TranSummar-master/transformer.py", line 106, in forward q *= self.scaling RuntimeError: Output 0 of SplitBackward0 is a view and is being modified inplace. This view is the output of a function that returns multiple views. Such functions do not allow the output views to be modified inplace. You should replace the inplace operation by an out-of-place one.

Could u fix this bug or provide a requirement file for running this project successfully~

FAFUxrhuang commented 1 year ago

Hello, may I ask if you have solved this problem?

lipiji commented 1 year ago

fixed

ouyangmemgmemg commented 1 year ago

hello,may I ask if you how to solve this problem?

FAFUxrhuang commented 1 year ago

hello,may I ask if you how to solve this problem?

q x= self.scaling→→→q = qxself.scaling