Can't import load_metric from datasets

Hi. I’m trying to follow this tutorial: Getting Started with Sentiment Analysis using Python (huggingface.co)

When running this line: from datasets import load_metric

I get an import error. “load_metric” isn’t found.

Any thoughts?

1 Like

Support for load_metric have been removed in datasets@3.0.0, see Release 3.0.0 · huggingface/datasets · GitHub.

You now have to use the evaluate library: 🤗 Evaluate

Thanks! I’ll look into that!

Try the following:

pip install evaluate

import evaluate

metric = evaluate.load(“accuracy”)

2 Likes