Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tensor error #11

Open
kaliaanup opened this issue Mar 12, 2022 · 0 comments
Open

tensor error #11

kaliaanup opened this issue Mar 12, 2022 · 0 comments

Comments

@kaliaanup
Copy link

Hi I am trying to run the code on a GPU machine using my dataset. I am getting the following error, Can you please check?

Save cache to caches/tweet_dataset_bert_elmo_bioes_adatrans_True_123_10_10_10.pkl.
training epochs started 2022-03-12-16-43-15
Traceback (most recent call last):
File "/home/akalia/aesiner_project/train_bert_elmo_en.py", line 237, in
trainer.train(load_best_model=False)
File "/home/akalia/aesiner_project/fastNLP/core/trainer.py", line 702, in train
raise e
File "/home/akalia/aesiner_project/fastNLP/core/trainer.py", line 695, in train
self._train()
File "/home/akalia/aesiner_project/fastNLP/core/trainer.py", line 894, in _train
prediction = self._data_forward(self.model, batch_x)
File "/home/akalia/aesiner_project/fastNLP/core/trainer.py", line 1003, in _data_forward
y = network(
File "/home/akalia/anaconda3/envs/akalia/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/home/akalia/aesiner_project/models/TENER.py", line 444, in forward
return self._forward(chars, target, bigrams, pos_features, dep_features, chunk_features,
File "/home/akalia/aesiner_project/models/TENER.py", line 411, in _forward
hidden = self.embed(chars)
File "/home/akalia/anaconda3/envs/akalia/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/home/akalia/aesiner_project/fastNLP/embeddings/stack_embedding.py", line 94, in forward
outputs.append(embed(words))
File "/home/akalia/anaconda3/envs/akalia/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/home/akalia/aesiner_project/fastNLP/embeddings/elmo_embedding.py", line 136, in forward
outputs = self.model(words)
File "/home/akalia/anaconda3/envs/akalia/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/home/akalia/aesiner_project/fastNLP/embeddings/elmo_embedding.py", line 313, in forward
encoder_output = self.encoder(token_embedding, seq_len)
File "/home/akalia/anaconda3/envs/akalia/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/home/akalia/aesiner_project/fastNLP/modules/encoder/_elmo.py", line 319, in forward
inputs = nn.utils.rnn.pack_padded_sequence(inputs, sort_lens, batch_first=True)
File "/home/akalia/anaconda3/envs/akalia/lib/python3.9/site-packages/torch/nn/utils/rnn.py", line 249, in pack_padded_sequence
_VF._pack_padded_sequence(input, lengths, batch_first)
RuntimeError: 'lengths' argument should be a 1D CPU int64 tensor, but got 1D cuda:0 Long tensor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant