regex.sh

regex.sh

Hi guys,

I tried to load Facebook hugging face model for text translation

Bumblebee.load_model({:hf, "facebook/m2m100_418M"})

But I got following error, any help is welcome :slight_smile:

** (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)

Showing Posts 1 to 4

NickGnd

NickGnd

Hey @regex.sh :wave:
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)

:point_up: 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 :grimacing:

To conclude, in this PR the model M2M100 is listed as a variation of Bart and MBart.

Good luck :crossed_fingers:

NickGnd

NickGnd

Hey @regex.sh

I just realized that there is an open PR in Bumblebee to add the M2M100 model
https://github.com/elixir-nx/bumblebee/pull/42

I don’t know what’s its state tho’, but I guess it is worth looking.

Cheers :v:

regex.sh

regex.sh OP

Hi @NickGnd, thank you for the extensive reponse! :heart:
I will give it a shot and write update here.

regex.sh

regex.sh OP

Okay, update as promised

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 :smiley:

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews