Thanks for your reply. Please find enclosed more detailed information.
DATAS:
test-fr-pos.txt file:
Abbaye│TOK de│TOK Cleeve│TOK
Le│TOK dortoir│TOK de│TOK
test-en-pos.txt file:
Cleeve│TOK Abbey│TOK
The│TOK Dormitory│TOK at│TOK
PREPROCESS made with:
onmt_preprocess -train_src test-fr-pos.txt -train_tgt test-en-pos.txt -valid_src test-fr-pos.txt -valid_tgt test-en-pos.txt -save_data preprocess
TRAINING made with:
onmt_train --batch_size=1 --train_steps 4 --save_checkpoint_steps 2 -world_size 1 -gpu_ranks 0 -save_model output/model -data output/preprocess -world_size 1 -gpu_ranks 0
TRANSLATION tried with:
onmt_translate -gpu 0 -replace_unk -model output/model_step_4.pt -src essai-pos.txt -output translation.txt
With essai-pos.txt file:
Abbaye│TOK Abbaye│TOK
and the traceback is:
[2020-04-24 00:48:39,429 INFO] Translating shard 0.
/home/yunes/anaconda3/envs/OpenNMT1.0.0rc2/lib/python3.7/site-packages/torchtext/data/field.py:359: 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 “/home/yunes/anaconda3/envs/OpenNMT1.0.0rc2/bin/onmt_translate”, line 8, in
sys.exit(main())
File “/home/yunes/anaconda3/envs/OpenNMT1.0.0rc2/lib/python3.7/site-packages/onmt/bin/translate.py”, line 49, in main
translate(opt)
File “/home/yunes/anaconda3/envs/OpenNMT1.0.0rc2/lib/python3.7/site-packages/onmt/bin/translate.py”, line 33, in translate
attn_debug=opt.attn_debug
File “/home/yunes/anaconda3/envs/OpenNMT1.0.0rc2/lib/python3.7/site-packages/onmt/translate/translator.py”, line 351, in translate
batch, data.src_vocabs, attn_debug
File “/home/yunes/anaconda3/envs/OpenNMT1.0.0rc2/lib/python3.7/site-packages/onmt/translate/translator.py”, line 544, in translate_batch
return_attention=attn_debug or self.replace_unk)
File “/home/yunes/anaconda3/envs/OpenNMT1.0.0rc2/lib/python3.7/site-packages/onmt/translate/translator.py”, line 693, in _translate_batch
batch_offset=beam._batch_offset)
File “/home/yunes/anaconda3/envs/OpenNMT1.0.0rc2/lib/python3.7/site-packages/onmt/translate/translator.py”, line 582, in _decode_and_generate
decoder_in, memory_bank, memory_lengths=memory_lengths, step=step
File “/home/yunes/anaconda3/envs/OpenNMT1.0.0rc2/lib/python3.7/site-packages/torch/nn/modules/module.py”, line 532, in call
result = self.forward(*input, **kwargs)
File “/home/yunes/anaconda3/envs/OpenNMT1.0.0rc2/lib/python3.7/site-packages/onmt/decoders/decoder.py”, line 214, in forward
tgt, memory_bank, memory_lengths=memory_lengths)
File “/home/yunes/anaconda3/envs/OpenNMT1.0.0rc2/lib/python3.7/site-packages/onmt/decoders/decoder.py”, line 381, in run_forward_pass
emb = self.embeddings(tgt)
File “/home/yunes/anaconda3/envs/OpenNMT1.0.0rc2/lib/python3.7/site-packages/torch/nn/modules/module.py”, line 532, in call
result = self.forward(*input, **kwargs)
File “/home/yunes/anaconda3/envs/OpenNMT1.0.0rc2/lib/python3.7/site-packages/onmt/modules/embeddings.py”, line 277, in forward
source = self.make_embedding(source)
File “/home/yunes/anaconda3/envs/OpenNMT1.0.0rc2/lib/python3.7/site-packages/torch/nn/modules/module.py”, line 532, in call
result = self.forward(*input, **kwargs)
File “/home/yunes/anaconda3/envs/OpenNMT1.0.0rc2/lib/python3.7/site-packages/torch/nn/modules/container.py”, line 100, in forward
input = module(input)
File “/home/yunes/anaconda3/envs/OpenNMT1.0.0rc2/lib/python3.7/site-packages/torch/nn/modules/module.py”, line 532, in call
result = self.forward(*input, **kwargs)
File “/home/yunes/anaconda3/envs/OpenNMT1.0.0rc2/lib/python3.7/site-packages/onmt/modules/util_class.py”, line 32, in forward
assert len(self) == len(inputs)
AssertionError