Traceback (most recent call last):
File “/usr/local/bin/ct2-opennmt-py-converter”, line 8, in
sys.exit(main())
File “/usr/local/lib/python3.6/dist-packages/ctranslate2/bin/opennmt_py_converter.py”, line 11, in main
converters.OpenNMTPyConverter(args.model_path).convert_from_args(args)
File “/usr/local/lib/python3.6/dist-packages/ctranslate2/converters/converter.py”, line 40, in convert_from_args
force=args.force)
File “/usr/local/lib/python3.6/dist-packages/ctranslate2/converters/converter.py”, line 52, in convert
src_vocab, tgt_vocab = self._load(model_spec)
File “/usr/local/lib/python3.6/dist-packages/ctranslate2/converters/opennmt_py.py”, line 22, in _load
checkpoint = torch.load(self._model_path, map_location=“cpu”)
File “/usr/local/lib/python3.6/dist-packages/torch/serialization.py”, line 593, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File “/usr/local/lib/python3.6/dist-packages/torch/serialization.py”, line 773, in _legacy_load
result = unpickler.load()
File “/usr/local/lib/python3.6/dist-packages/torchtext/vocab.py”, line 119, in setstate
if state[‘unk_index’] is None:
KeyError: ‘unk_index’
Hi, I upgraded to torchtext-0.6 . But I get the following error while converting a transformer model: ------------ File “/home/lto/.local/lib/python3.7/site-packages/ctranslate2/converters/converter.py”, line 52, in convert src_vocab, tgt_vocab = self._load(model_spec) File “/home/lto/.local/lib/python3.7/site-packages/ctranslate2/converters/opennmt_py.py”, line 24, in _load variables[“generator.weight”] = checkpoint[“generator”][“0.weight”] KeyError: ‘0.weight’ ------------- Any help is appreciated. Thanks
Hi Guullaume,
I updated to openNMT-py 1.1.1 and Pytorch 1.4.
I used onmt_release_model as you suggested. It works now. Yes, I used int16 (float16 gives error).
Thanks a lot.