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

Execution of example from the Using the evaluator docs fails due to unspecified tokenizer #594

Open
jpodivin opened this issue Jun 2, 2024 · 0 comments · May be fixed by #595
Open

Execution of example from the Using the evaluator docs fails due to unspecified tokenizer #594

jpodivin opened this issue Jun 2, 2024 · 0 comments · May be fixed by #595

Comments

@jpodivin
Copy link

jpodivin commented Jun 2, 2024

Instead of calculating metrics, the first example of evaluation[1] fails since the tokenizer isn't provided nor inferred.

Exception: Impossible to guess which tokenizer to use. Please provide a PreTrainedTokenizer class or a path/identifier to a pretrained tokenizer.

To replicate, simply try to execute following:

from datasets import load_dataset
from evaluate import evaluator
from transformers import AutoModelForSequenceClassification, pipeline

data = load_dataset("imdb", split="test").shuffle(seed=42).select(range(1000))
task_evaluator = evaluator("text-classification")

# 1. Pass a model name or path
eval_results = task_evaluator.compute(
    model_or_pipeline="lvwerra/distilbert-imdb",
    data=data,
    label_mapping={"NEGATIVE": 0, "POSITIVE": 1}
)

# 2. Pass an instantiated model
model = AutoModelForSequenceClassification.from_pretrained("lvwerra/distilbert-imdb")

eval_results = task_evaluator.compute(
    model_or_pipeline=model,
    data=data,
    label_mapping={"NEGATIVE": 0, "POSITIVE": 1}
)

evaluate===0.4.1

[1]https://huggingface.co/docs/evaluate/base_evaluator

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 a pull request may close this issue.

1 participant