yuzhimanhua / Multi-BioNER

Cross-type Biomedical Named Entity Recognition with Deep Multi-task Learning (Bioinformatics'19)
https://arxiv.org/abs/1801.09851
Apache License 2.0
131 stars 28 forks source link

RuntimeError: expand(torch.cuda.LongTensor{[50, 1]}, size=[50]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2) #3

Closed asifkhan2017 closed 5 years ago

asifkhan2017 commented 5 years ago

I am getting this error

Traceback (most recent call last): File "train_wc.py", line 288, in dev_f1, dev_pre, dev_rec, dev_acc = evaluator.calc_score(ner_model, dev_dataset_loader[file_no], file_no) File "F:\Projects\Python\NLP\Multi-BioNER-master\model\evaluator.py", line 210, in calc_score decoded = self.decoder.decode(scores.data, mask_v.data) File "F:\Projects\Python\NLP\Multi-BioNER-master\model\crf.py", line 387, in decode decode_idx[idx] = pointer RuntimeError: expand(torch.cuda.LongTensor{[50, 1]}, size=[50]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)

asifkhan2017 commented 5 years ago

The issue was in torch version. Lm_lstm_crf only works with pytorch 0.2 or 0.3 version.