Skip to content

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

@XiaoyaWang-gh

Description

@XiaoyaWang-gh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions