Error in converting Fairseq Wikitext-103 transformer_lm model

When converting to ctranslate2 a fairseq transformer_lm model trained on Wikitext-103, I get a ConfigAttributeError:

Traceback (most recent call last):
File “/usr/local/bin/ct2-fairseq-converter”, line 8, in
File “/usr/local/lib/python3.8/dist-packages/ctranslate2/converters/”, line 341, in main
File “/usr/local/lib/python3.8/dist-packages/ctranslate2/converters/”, line 50, in convert_from_args
return self.convert(
File “/usr/local/lib/python3.8/dist-packages/ctranslate2/converters/”, line 89, in convert
model_spec = self._load()
File “/usr/local/lib/python3.8/dist-packages/ctranslate2/converters/”, line 152, in _load = self._data_dir
File “/usr/local/lib/python3.8/dist-packages/omegaconf/”, line 285, in setattr
raise e
File “/usr/local/lib/python3.8/dist-packages/omegaconf/”, line 282, in setattr
self.__set_impl(key, value)
File “/usr/local/lib/python3.8/dist-packages/omegaconf/”, line 266, in __set_impl
self._set_item_impl(key, value)
File “/usr/local/lib/python3.8/dist-packages/omegaconf/”, line 398, in _set_item_impl
self._validate_set(key, value)
File “/usr/local/lib/python3.8/dist-packages/omegaconf/”, line 143, in _validate_set
self._validate_set_merge_impl(key, value, is_assign=True)
File “/usr/local/lib/python3.8/dist-packages/omegaconf/”, line 176, in _validate_set_merge_impl
target = self._get_node(key)
File “/usr/local/lib/python3.8/dist-packages/omegaconf/”, line 383, in _get_node
File “/usr/local/lib/python3.8/dist-packages/omegaconf/”, line 135, in _validate_get
File “/usr/local/lib/python3.8/dist-packages/omegaconf/”, line 95, in _format_and_raise
File “/usr/local/lib/python3.8/dist-packages/omegaconf/”, line 694, in format_and_raise
_raise(ex, cause)
File “/usr/local/lib/python3.8/dist-packages/omegaconf/”, line 610, in _raise
raise ex # set end OC_CAUSE=1 for full backtrace
omegaconf.errors.ConfigAttributeError: Key ‘data’ is not in struct

Other fairseq Transformer models are converted just fine.

Any hint on how to solve the issue?

Thank you,


One reason might be that the trained model’s ‘args’ value is empty, whereas it is full of data in the pretrained WMT19 language model used an example in CTranslate2 documentation. Yet the model seems to work in fairseq, so it is supposed to be a valid transformer_lm model.