ASSERT-KTH / ASSERT-KTH/sequencer

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

Open
#36 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
87
Forks
40
PR merge metrics
No merged PRs in 30d

Description

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
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
`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with sequencer-test.sh and translate.py, then follow the reported call path through onmt/translate/translator.py, onmt/encoders/rnn_encoder.py, onmt/modules/embeddings.py, and onmt/modules/util_class.py. Run sequencer-test.sh start and inspect why outputs reaches torch.cat as None; done means the command completes without this TypeError and produces valid translation output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.