chinge55 / moses

Molecular Sets (MOSES): A Benchmarking Platform for Molecular Generation Models
https://arxiv.org/abs/1811.12823
MIT License
1 stars 0 forks source link

Problems with training a few models on GPU #1

Closed chinge55 closed 1 year ago

chinge55 commented 1 year ago

Two Models:

Error:

RuntimeError: 'lengths' argument should be a 1D CPU int64 tensor, but got 1D cuda:2 Long tensor
chinge55 commented 1 year ago

In case of CharRNN: Modifying the code, i.e sending the lengths to cpu seems to do the trick. Maybe something updated in the newer versions of pytorch ?

In the file line 31:

moses/char_rnn/model.py  
x = rnn_utils.pack_padded_sequence(x, lengths.cpu(), batch_first=True)