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

TypeError: expected Tensor as element 0 in argument 0, but got NoneType #36

Open
XiaoyaWang-gh opened this issue Mar 4, 2022 · 0 comments

Comments

@XiaoyaWang-gh
Copy link

When I run the sequencer-test.sh,I got the following error.It seems like the variable outputs is empty.
sequencer-test.sh start Starting test data translation /home/xiaoyawang/miniconda3/envs/py36/lib/python3.6/site-packages/torchtext/legacy/data/field.py:353: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor). var = torch.tensor(arr, dtype=self.dtype, device=device) Traceback (most recent call last): File "translate.py", line 35, in <module> main(opt) File "translate.py", line 20, in main attn_debug=opt.attn_debug File "/home/xiaoyawang/sequencer/src/lib/OpenNMT-py/onmt/translate/translator.py", line 210, in translate batch, data, attn_debug, fast=self.fast File "/home/xiaoyawang/sequencer/src/lib/OpenNMT-py/onmt/translate/translator.py", line 354, in translate_batch return self._translate_batch(batch, data) File "/home/xiaoyawang/sequencer/src/lib/OpenNMT-py/onmt/translate/translator.py", line 666, in _translate_batch batch, data_type) File "/home/xiaoyawang/sequencer/src/lib/OpenNMT-py/onmt/translate/translator.py", line 364, in _run_encoder src, src_lengths) File "/home/xiaoyawang/miniconda3/envs/py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/xiaoyawang/sequencer/src/lib/OpenNMT-py/onmt/encoders/rnn_encoder.py", line 55, in forward emb = self.embeddings(src) File "/home/xiaoyawang/miniconda3/envs/py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/xiaoyawang/sequencer/src/lib/OpenNMT-py/onmt/modules/embeddings.py", line 205, in forward source = self.make_embedding(source) File "/home/xiaoyawang/miniconda3/envs/py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/xiaoyawang/miniconda3/envs/py36/lib/python3.6/site-packages/torch/nn/modules/container.py", line 119, in forward input = module(input) File "/home/xiaoyawang/miniconda3/envs/py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/xiaoyawang/sequencer/src/lib/OpenNMT-py/onmt/modules/util_class.py", line 31, in forward return torch.cat(outputs, 2) TypeError: expected Tensor as element 0 in argument 0, but got NoneType sequencer-test.sh done

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

No branches or pull requests

1 participant