Migrate metric to Evaluate in Pytorch examples (#18369)

* Migrate metric to Evaluate in pytorch examples

* Remove unused imports
This commit is contained in:
atturaioe
2022-08-01 14:40:25 +03:00
committed by GitHub
parent 25ec12eaf7
commit 1f84399171
25 changed files with 72 additions and 49 deletions

View File

@@ -26,8 +26,9 @@ from typing import Optional
import datasets
import numpy as np
from datasets import load_dataset, load_metric
from datasets import load_dataset
import evaluate
import transformers
from transformers import (
AutoConfig,
@@ -349,7 +350,7 @@ def main():
)
# Get the metric function
metric = load_metric("xnli")
metric = evaluate.load("xnli")
# You can define your custom compute_metrics function. It takes an `EvalPrediction` object (a namedtuple with a
# predictions and label_ids field) and has to return a dictionary string to float.