A more than 1000X faster paralleled LSTM-CRF implementation modified from the slower version in the Pytorch official tutorial (URL:https://pytorch.org/tutorials/beginner/nlp/advanced_tutorial.html).
204
stars
50
forks
source link
RuntimeError when using torch.full() in PyTorch 1.7 #3
when I run LSTM_CRF_faster_parallel.py I meet this error:
Traceback (most recent call last):
loss = model.neg_log_likelihood_parallel(sentence_in_pad, targets_pad)
File ".\bi_lstm_crf_faster_parallel.py", line 306, in neg_log_likelihood_parallel
gold_score = self._score_sentence_parallel(feats, tags)
tags = torch.cat([torch.full([tags.shape[0],1],self.tag_to_ix[START_TAG]).long(),tags],dim=1)
RuntimeError: Providing a bool or integral fill value without setting the optional `dtype` or `out` arguments is currently unsupported. In PyTorch 1.7, when `dtype` and `out` are not set a bool fill value will return a tensor of torch.bool dtype, and an integral fill value will return a tensor of torch.long dtype.
when I run LSTM_CRF_faster_parallel.py I meet this error:
as the latest doc says, I think line 201
should be changed to
🤗