Open nomadlx opened 4 years ago
The error traceback:
File "/home/exp_or_nmt/code/OR-NMT/OR-Transformer/fairseq/trainer.py", line 380, in train_step
raise e
File "/home/exp_or_nmt/code/OR-NMT/OR-Transformer/fairseq/trainer.py", line 358, in train_step
ignore_grad=is_dummy_batch,
File "/home/exp_or_nmt/code/OR-NMT/OR-Transformer/fairseq/tasks/fairseq_task.py", line 337, in train_step
loss, sample_size, logging_output = criterion(model, sample)
File "/home/exp_or_nmt/code/OR-NMT/venv/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/exp_or_nmt/code/OR-NMT/OR-Transformer/fairseq/criterions/label_smoothed_cross_entropy.py", line 56, in forward
net_output = model(**sample['net_input'])
File "/home/exp_or_nmt/code/OR-NMT/venv/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/exp_or_nmt/code/OR-NMT/venv/lib/python3.7/site-packages/torch/nn/parallel/distributed.py", line 619, in forward
output = self.module(*inputs[0], **kwargs[0])
File "/home/exp_or_nmt/code/OR-NMT/venv/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/exp_or_nmt/code/OR-NMT/OR-Transformer/fairseq/models/oracle_transformer.py", line 346, in forward
prev_output_tokens, src_tokens, src_lengths, target)
File "/home/exp_or_nmt/code/OR-NMT/venv/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context
return func(*args, **kwargs)
File "/home/exp_or_nmt/code/OR-NMT/OR-Transformer/fairseq/models/oracle_transformer.py", line 303, in get_sentence_oracle_tokens
out = self.generator.generate([self], sample, target, noise=noise)
File "/home/exp_or_nmt/code/OR-NMT/venv/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context
return func(*args, **kwargs)
File "/home/exp_or_nmt/code/OR-NMT/OR-Transformer/fairseq/sequence_generator.py", line 92, in generate
return self._generate(model, sample, target=target, noise=noise, **kwargs)
File "/home/exp_or_nmt/code/OR-NMT/venv/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context
return func(*args, **kwargs)
File "/home/exp_or_nmt/code/OR-NMT/OR-Transformer/fairseq/sequence_generator.py", line 393, in _generate
out=eos_bbsz_idx,
RuntimeError: masked_select(): self and result must have the same scalar type
The BUG seems to have been caused here: https://github.com/ictnlp/OR-NMT/blob/239e05e48c2ed4748de01e8909f919e836d821db/OR-Transformer/fairseq/search.py#L78 right is:
beams_buf = indices_buf // vocab_size
This bug was fixed, but another bug popped up...
File "/home/exp_or_nmt/code/OR-NMT/OR-Transformer/fairseq/models/oracle_transformer.py", line 304, in get_sentence_oracle_tokens
sentence_oracle_inputs = torch.ones_like(target)
TypeError: ones_like(): argument 'input' (position 1) must be Tensor, not NoneType
Is it work well when you run it?
The BUG seems to have been caused here:
right is:
beams_buf = indices_buf // vocab_size
This bug was fixed, but another bug popped up...
File "/home/exp_or_nmt/code/OR-NMT/OR-Transformer/fairseq/models/oracle_transformer.py", line 304, in get_sentence_oracle_tokens sentence_oracle_inputs = torch.ones_like(target) TypeError: ones_like(): argument 'input' (position 1) must be Tensor, not NoneType
Is it work well when you run it?
Thank you so much! This solution works, but the another bug didn't pop out in my BART inference procedure.
This error occurs after saving the model. And my parameters are configured as follows: