laddie132 / Match-LSTM

A PyTorch implemention of Match-LSTM, R-NET and M-Reader for Machine Reading Comprehension
MIT License
108 stars 21 forks source link

Run time Error regarding input size while training #4

Open sagin456 opened 5 years ago

sagin456 commented 5 years ago

I am trying to train the model (after pre-processing was done successfully) using python run.py train. I am using running Windows 10, Python 3.6.5, spaCy 2.0.0, pytorch 0.4.0 Unfortunately, I am receiving a run time error .

2019-05-02 18:47:45,082 - [train.py:22-train()] - INFO - ------------MODEL TRAIN-------------- 2019-05-02 18:47:45,082 - [train.py:23-train()] - INFO - loading config file... 2019-05-02 18:47:45,082 - [train.py:37-train()] - INFO - reading squad dataset... 2019-05-02 18:47:49,647 - [train.py:40-train()] - INFO - constructing model... 2019-05-02 18:47:50,334 - [train.py:89-train()] - INFO - start training... Traceback (most recent call last): File "C:/Users/Administrator/PycharmProjects/Match-LSTM/run.py", line 38, in train(args.config_path) File "C:\Users\Administrator\PycharmProjects\Match-LSTM\train.py", line 110, in train device=device) File "C:\Users\Administrator\PycharmProjects\Match-LSTM\train.py", line 162, in train_on_model ans_rangeprop, , _ = model.forward(*batch_input) File "C:\Users\Administrator\PycharmProjects\Match-LSTM\models\match_lstm_plus.py", line 119, in forward contextencode, = self.encoder.forward(context_vec, context_mask) File "C:\Users\Administrator\PycharmProjects\Match-LSTM\models\layers.py", line 716, in forward o_packdropout, = self.hidden.forward(v_pack_dropout) File "C:\Users\Administrator\Anaconda3\lib\site-packages\torch\nn\modules\rnn.py", line 178, in forward self.check_forward_args(input, hx, batch_sizes) File "C:\Users\Administrator\Anaconda3\lib\site-packages\torch\nn\modules\rnn.py", line 130, in check_forward_args self.input_size, input.size(-1))) RuntimeError: input.size(-1) must be equal to input_size. Expected 373, got 372

Process finished with exit code 1

Would appreciate any help regarding this. Thanks!

dzzxjl commented 5 years ago

@sagin456 Have you solve this problem? i meet it too.

chaoyueziji commented 4 years ago

I also meet it

Xuehuiquan commented 4 years ago

I am trying to train the model (after pre-processing was done successfully) using python run.py train. I am using running Windows 10, Python 3.6.5, spaCy 2.0.0, pytorch 0.4.0,torch.version.cuda 8.0 Unfortunately, I am receiving a run time error .

THCudaCheck FAIL file=C:/ProgramData/Miniconda3/conda-bld/pytorch_1524543037166/work/aten/src/THC/THCTensorCopy.cu line=100 error=4 : unspecified launch failure Traceback (most recent call last): File "run.py", line 37, in train(args.config_path) File "D:\PycharmProjects\Match-LSTM_R-Net_M-Reader-on-SQuAD\Match-LSTM-master\train.py", line 114, in train device=device) File "D:\PycharmProjects\Match-LSTM_R-Net_M-Reader-on-SQuAD\Match-LSTM-master\train.py", line 170, in train_on_model loss.backward() File "C:\Users\xhq\anaconda3\envs\pt0.4\lib\site-packages\torch\tensor.py", line 93, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph) File "C:\Users\xhq\anaconda3\envs\pt0.4\lib\site-packages\torch\autograd__init__.py", line 89, in backward allow_unreachable=True) # allow_unreachable flag File "C:\Users\xhq\anaconda3\envs\pt0.4\lib\site-packages\torch\autograd\function.py", line 76, in apply return self._forward_cls.backward(self, *args) File "C:\Users\xhq\anaconda3\envs\pt0.4\lib\site-packages\torch\nn_functions\packing.py", line 50, in backward grad_input[i, :bs] = grad_steps[offset:offset + bs] RuntimeError: cuda runtime error (4) : unspecified launch failure at C:/ProgramData/Miniconda3/conda-bld/pytorch_1524543037166/work/ aten/src/THC/THCTensorCopy.cu:100

Saipriya6009 commented 7 months ago

I am trying to train the model (after pre-processing was done successfully) using python run.py train. I am using running Windows 10, Python 3.6.5, spaCy 2.0.0, pytorch 0.4.0,torch.version.cuda 8.0 Unfortunately, I am receiving a run time error .

THCudaCheck FAIL file=C:/ProgramData/Miniconda3/conda-bld/pytorch_1524543037166/work/aten/src/THC/THCTensorCopy.cu line=100 error=4 : unspecified launch failure Traceback (most recent call last): File "run.py", line 37, in train(args.config_path) File "D:\PycharmProjects\Match-LSTM_R-Net_M-Reader-on-SQuAD\Match-LSTM-master\train.py", line 114, in train device=device) File "D:\PycharmProjects\Match-LSTM_R-Net_M-Reader-on-SQuAD\Match-LSTM-master\train.py", line 170, in train_on_model loss.backward() File "C:\Users\xhq\anaconda3\envs\pt0.4\lib\site-packages\torch\tensor.py", line 93, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph) File "C:\Users\xhq\anaconda3\envs\pt0.4\lib\site-packages\torch\autogradinit.py", line 89, in backward allow_unreachable=True) # allow_unreachable flag File "C:\Users\xhq\anaconda3\envs\pt0.4\lib\site-packages\torch\autograd\function.py", line 76, in apply return self._forward_cls.backward(self, *args) File "C:\Users\xhq\anaconda3\envs\pt0.4\lib\site-packages\torch\nn_functions\packing.py", line 50, in backward grad_input[i, :bs] = grad_steps[offset:offset + bs] RuntimeError: cuda runtime error (4) : unspecified launch failure at C:/ProgramData/Miniconda3/conda-bld/pytorch_1524543037166/work/ aten/src/THC/THCTensorCopy.cu:100

Have you completely run it sir/mam?

Saipriya6009 commented 7 months ago

I am trying to train the model (after pre-processing was done successfully) using python run.py train. I am using running Windows 10, Python 3.6.5, spaCy 2.0.0, pytorch 0.4.0 Unfortunately, I am receiving a run time error .

2019-05-02 18:47:45,082 - [train.py:22-train()] - INFO - ------------MODEL TRAIN-------------- 2019-05-02 18:47:45,082 - [train.py:23-train()] - INFO - loading config file... 2019-05-02 18:47:45,082 - [train.py:37-train()] - INFO - reading squad dataset... 2019-05-02 18:47:49,647 - [train.py:40-train()] - INFO - constructing model... 2019-05-02 18:47:50,334 - [train.py:89-train()] - INFO - start training... Traceback (most recent call last): File "C:/Users/Administrator/PycharmProjects/Match-LSTM/run.py", line 38, in train(args.config_path) File "C:\Users\Administrator\PycharmProjects\Match-LSTM\train.py", line 110, in train device=device) File "C:\Users\Administrator\PycharmProjects\Match-LSTM\train.py", line 162, in train_on_model ans_rangeprop, , _ = model.forward(*batch_input) File "C:\Users\Administrator\PycharmProjects\Match-LSTM\models\match_lstm_plus.py", line 119, in forward contextencode, = self.encoder.forward(context_vec, context_mask) File "C:\Users\Administrator\PycharmProjects\Match-LSTM\models\layers.py", line 716, in forward o_packdropout, = self.hidden.forward(v_pack_dropout) File "C:\Users\Administrator\Anaconda3\lib\site-packages\torch\nn\modules\rnn.py", line 178, in forward self.check_forward_args(input, hx, batch_sizes) File "C:\Users\Administrator\Anaconda3\lib\site-packages\torch\nn\modules\rnn.py", line 130, in check_forward_args self.input_size, input.size(-1))) RuntimeError: input.size(-1) must be equal to input_size. Expected 373, got 372

Process finished with exit code 1

Would appreciate any help regarding this. Thanks!

Did you rectify this error later and got the results?