NER-BERT-pytorch icon indicating copy to clipboard operation
NER-BERT-pytorch copied to clipboard

bert-lstm-crf_run.py

Open Kingsuuun opened this issue 3 years ago • 0 comments

Traceback (most recent call last): File "run.py", line 138, in run() File "run.py", line 134, in run train(train_loader, dev_loader, model, optimizer, scheduler, config.model_dir) File "/home/ym/test2/CLU/BERT-LSTM-CRF/train.py", line 47, in train train_epoch(train_loader, model, optimizer, scheduler, epoch) File "/home/ym/test2/CLU/BERT-LSTM-CRF/train.py", line 22, in train_epoch token_type_ids=None, attention_mask=batch_masks, labels=batch_labels)[0] File "/home/ym/anaconda3/envs/test/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/home/ym/test2/CLU/BERT-LSTM-CRF/model.py", line 52, in forward logits = self.classifier(lstm_output) File "/home/ym/anaconda3/envs/test/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/home/ym/anaconda3/envs/test/lib/python3.7/site-packages/torch/nn/modules/linear.py", line 103, in forward return F.linear(input, self.weight, self.bias) File "/home/ym/anaconda3/envs/test/lib/python3.7/site-packages/torch/nn/functional.py", line 1848, in linear return torch._C._nn.linear(input, weight, bias) RuntimeError: mat1 and mat2 shapes cannot be multiplied (1600x2048 and 1024x31)

please help me😬

Kingsuuun avatar Dec 19 '21 14:12 Kingsuuun