The example script seems to not work

#3
by ybelkada HF staff - opened

Hi!

I am trying to run the example script on the model card and it seems to crash with the following error:

import evaluate

toxicity = evaluate.load("toxicity", 'DaNLP/da-electra-hatespeech-detection', module_type="measurement",)
input_texts = ["she went to the library", "he is a douchebag"]
results = toxicity.compute(predictions=input_texts)
>>>  in toxicity                                                                                      โ”‚
โ”‚                                                                                                  โ”‚
โ”‚    96 def toxicity(preds, toxic_classifier, toxic_label):                                        โ”‚
โ”‚    97 โ”‚   toxic_scores = []                                                                      โ”‚
โ”‚    98 โ”‚   if toxic_label not in toxic_classifier.model.config.id2label.values():                 โ”‚
โ”‚ โฑ  99 โ”‚   โ”‚   raise ValueError(                                                                  โ”‚
โ”‚   100 โ”‚   โ”‚   โ”‚   "The `toxic_label` that you specified is not part of the model labels. Run `   โ”‚
โ”‚   101 โ”‚   โ”‚   )                                                                                  โ”‚
โ”‚   102                                                                                            โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
ValueError: The `toxic_label` that you specified is not part of the model labels. Run `model.config.id2label` to see what labels your model outputs.

Any help appreciated! Thanks!

Sign up or log in to comment