** (RuntimeError) could not match the class name "M2M100ForConditionalGeneration" to any of the supported models, please specify the :module and :architecture options
(bumblebee 0.1.2) lib/bumblebee.ex:262: Bumblebee.load_spec/2
(bumblebee 0.1.2) lib/bumblebee.ex:372: Bumblebee.load_model/2
iex:3: (file)
Hey @regex.sh
I donât know much about Bumblebee, but I think you are getting that error because the model "facebook/m2m100_418M" is not implemented in Bumblebee yet.
You can find the all the models and tokenizers implemented in the docs (see the âModelsâ section in the navigation menu on the left).
Besides that, I read a blog post lately and i think it might be interesting for you as well, there is a section about âMachine Translationâ.
In particular this is the snippet of code:
model_name = "facebook/mbart-large-en-ro"
{:ok, model} = Bumblebee.load_model({:hf, model_name},
module: Bumblebee.Text.Mbart,
architecture: :for_conditional_generation
)
{:ok, tokenizer} = Bumblebee.load_tokenizer({:hf, model_name})
article = """
Elixir is a dynamic, functional language for building scalable and maintainable applications.
"""
serving = Bumblebee.Text.Generation.generation(model, tokenizer,
max_new_tokens: 20,
forced_bos_token_id: 250041
)
Nx.Serving.run(serving, article)
If you run the snippet, it should return the sentence âElixir is a dynamic, âŠâ translated to romanian.
Maybe this can be a good starting point, you will need to replace the model_name with the one that you are trying to use "facebook/m2m100_418M" and to set the :module option in the load_tokenizer function too.
But I fear this wonât be enough because if I understood well the MBART tokenizer implemented in Bumblebee does not accept some parameters (e.g src_lang) that might be needed for M2M100 model, but I might be wrong, please take everything Iâm writing with a grain of salt
To conclude, in this PR the model M2M100 is listed as a variation of Bart and MBart.
I didnât get m2m100 to work (there are no fast tokenizers available), but I tried t5-base and it worked! (I wanted to use AI to translate text)
Anyhow I switched to Cloud translation by Google