OpenNMT / CTranslate2

Fast inference engine for Transformer models
https://opennmt.net/CTranslate2
MIT License
3.42k stars 304 forks source link

NLLB: module 'transformers' has no attribute 'AutoConfig' #886

Closed juliensalinas closed 2 years ago

juliensalinas commented 2 years ago

Hello @guillaumekln, thanks for adding the NLLB support.

I just tried the model conversion: ct2-transformers-converter --model facebook/nllb-200-distilled-600M --output_dir nllb-200-distilled-600M

It returns the following:

Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.10/site-packages/ctranslate2/converters/transformers.py", line 449, in <module>
    main()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/ctranslate2/converters/transformers.py", line 445, in main
    converter.convert_from_args(args)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/ctranslate2/converters/converter.py", line 50, in convert_from_args
    return self.convert(
  File "/home/ubuntu/.local/lib/python3.10/site-packages/ctranslate2/converters/converter.py", line 89, in convert
    model_spec = self._load()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/ctranslate2/converters/transformers.py", line 51, in _load
    config = transformers.AutoConfig.from_pretrained(self._model_name_or_path)
AttributeError: module 'transformers' has no attribute 'AutoConfig'

Here are the versions I'm using:

Am I missing something obvious?

Thanks!!

juliensalinas commented 2 years ago

PS: I notice it's happening with any model I'm trying to convert. Not only with NLLB. So there must be something wrong with my installation maybe...

guillaumekln commented 2 years ago

Hi,

Maybe you have directory named transformers or Python file named transformers.py in the current directory?

If not, can you double-check the Transformers version?

$ python3 -c "import transformers; print(transformers.__version__)"
4.21.0
juliensalinas commented 2 years ago

You are absolutely right. Really sorry about that! Thanks a lot.