Hi, thanks for this work, it helps me a lot..
I'm using Pytorch 1.4-1.5 previously. Everything runs fine. But when I switch to Pytorch 1.7, it returns RuntimeError with:
'lengths' argument should be a 1D CPU int64 tensor, but got 1D cuda:0 Long tensor
Here's full error stack:
File "/my_proj/utils/supar/parsers/biaffine_dependency.py", line 125, in predict
return super().predict(Config().update(locals()))
File "/my_proj/utils/supar/parsers/parser.py", line 135, in predict
preds = self._predict(dataset.loader)
File "/opt/conda/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context
return func(*args, *kwargs)
File "/my_proj/utils/supar/parsers/biaffine_dependency.py", line 187, in _predict
s_arc, s_rel = self.model(words, feats)
File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(input, kwargs)
File "/my_proj/utils/supar/models/dependency.py", line 199, in forward
feat_embed = self.feat_embed(feats)
File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/my_proj/utils/supar/modules/char_lstm.py", line 66, in forward
x = pack_padded_sequence(x, lens[char_mask], True, False)
File "/opt/conda/lib/python3.8/site-packages/torch/nn/utils/rnn.py", line 244, in pack_padded_sequence
_VF._pack_padded_sequence(input, lengths, batch_first)
@fenss I think it's a bug (pytorch/pytorch/issues/47637) of pytorch.
Please use pytorch<1.7 right now, or move the tensor lens to cpu as a temporary solution.
Hi, thanks for this work, it helps me a lot.. I'm using Pytorch 1.4-1.5 previously. Everything runs fine. But when I switch to Pytorch 1.7, it returns RuntimeError with:
Here's full error stack:
Is there any way to fix it?