regex.sh

regex.sh

Bumblee and Facebook M2M100 - getting (RuntimeError) could not match the class name "M2M100ForConditionalGeneration"

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)

Marked As Solved

regex.sh

regex.sh

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:

Also Liked

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

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

Cheers :v:

regex.sh

regex.sh

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

Where Next?

Popular in Questions Top

albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New

Other popular topics Top

malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43591 214
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
RisingFromAshes
I've read in another post that it may be possible with a router helper - but I couldn't find an appropriate one, and tbh, I'm still just ...
New
Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 126226 1237
New

We're in Beta

About us Mission Statement