Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downcase label before checking equality #327

Merged
merged 1 commit into from
Feb 7, 2024
Merged

Conversation

preciz
Copy link
Contributor

@preciz preciz commented Feb 7, 2024

Sometimes labels are in uppercase. So the library raises (ArgumentError) expected model specification to include "entailment" label in :id_to_label when building the zero shot classification.

For example here: https://huggingface.co/typeform/distilbert-base-uncased-mnli/blob/main/config.json

I tested this commit and it allows me to use the above mentioned model.

The code I used to test this commit:

Nx.default_backend({EXLA.Backend, []})

hf_model = "typeform/distilbert-base-uncased-mnli"

{:ok, model} = Bumblebee.load_model({:hf, hf_model})
{:ok, tokenizer} = Bumblebee.load_tokenizer({:hf, "distilbert/distilbert-base-uncased"})

serving = Bumblebee.Text.zero_shot_classification(model, tokenizer, ["Is clothes", "Is food"])

Nx.Serving.run(serving, "Steak is tasty")

Thank you for reviewing.

Copy link
Member

@jonatanklosko jonatanklosko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, thanks!

@jonatanklosko jonatanklosko merged commit 211ca92 into elixir-nx:main Feb 7, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants