OpenNMT / OpenNMT/CTranslate2

Converter not working for NLLB models

Open
#1,711 9 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
4.7k
Forks
536
Avg merge
12h 12m
Merged PRs (30d)
4

Description

When I run the following converter script:

ct2-transformers-converter --model facebook/nllb-200-distilled-1.3B --quantization float16 --output_dir nllb-200-distilled-1.3B-ct2-float16

I now get the following error:

config.json: 100%|████████████████████████████████████████████████████████████████████| 808/808 [00:00<00:00, 4.01MB/s] pytorch_model.bin: 100%|███████████████████████████████████████████████████████████| 5.48G/5.48G [00:22<00:00, 248MB/s] generation_config.json: 100%|█████████████████████████████████████████████████████████| 189/189 [00:00<00:00, 1.27MB/s] tokenizer_config.json: 100%|██████████████████████████████████████████████████████████| 564/564 [00:00<00:00, 3.51MB/s] sentencepiece.bpe.model: 100%|█████████████████████████████████████████████████████| 4.85M/4.85M [00:00<00:00, 139MB/s] tokenizer.json: 100%|██████████████████████████████████████████████████████████████| 17.3M/17.3M [00:00<00:00, 335MB/s] special_tokens_map.json: 100%|████████████████████████████████████████████████████| 3.55k/3.55k [00:00<00:00, 20.6MB/s] Traceback (most recent call last): File "/usr/local/bin/ct2-transformers-converter", line 8, in <module> sys.exit(main()) File "/usr/local/lib/python3.10/dist-packages/ctranslate2/converters/transformers.py", line 2234, in main converter.convert_from_args(args) File "/usr/local/lib/python3.10/dist-packages/ctranslate2/converters/converter.py", line 50, in convert_from_args return self.convert( File "/usr/local/lib/python3.10/dist-packages/ctranslate2/converters/converter.py", line 89, in convert model_spec = self._load() File "/usr/local/lib/python3.10/dist-packages/ctranslate2/converters/transformers.py", line 142, in _load spec = loader(model, tokenizer) File "/usr/local/lib/python3.10/dist-packages/ctranslate2/converters/transformers.py", line 194, in __call__ spec = self.get_model_spec(model) File "/usr/local/lib/python3.10/dist-packages/ctranslate2/converters/transformers.py", line 429, in get_model_spec return super().get_model_spec(model) File "/usr/local/lib/python3.10/dist-packages/ctranslate2/converters/transformers.py", line 257, in get_model_spec self.set_encoder(spec.encoder, model.model.encoder) File "/usr/local/lib/python3.10/dist-packages/ctranslate2/converters/transformers.py", line 286, in set_encoder self.set_common_layers(spec, encoder) File "/usr/local/lib/python3.10/dist-packages/ctranslate2/converters/transformers.py", line 347, in set_common_layers spec.scale_embeddings = module.embed_scale File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1709, in __getattr__ raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'") AttributeError: 'M2M100Encoder' object has no attribute 'embed_scale'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the command with the NLLB model, then inspect ctranslate2/converters/transformers.py around set_common_layers and the M2M100Encoder handling. Determine why the converter expects embed_scale, and verify that the command completes successfully after the compatibility fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.