Migrate metric to Evaluate library for tensorflow examples (#18327)
* Migrate metric to Evaluate library in tf examples Currently tensorflow examples use `load_metric` function from Datasets library , commit migrates function call to `load` function to Evaluate library. Fix for #18306 * Migrate metric to Evaluate library in tf examples Currently tensorflow examples use `load_metric` function from Datasets library , commit migrates function call to `load` function to Evaluate library. Fix for #18306 * Migrate `metric` to Evaluate for all tf examples Currently tensorflow examples use `load_metric` function from Datasets library , commit migrates function call to `load` function to Evaluate library.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
datasets >= 1.1.3
|
||||
sentencepiece != 0.1.92
|
||||
protobuf
|
||||
tensorflow >= 2.3
|
||||
tensorflow >= 2.3
|
||||
evaluate >= 0.2.0
|
||||
@@ -24,8 +24,9 @@ from typing import Optional
|
||||
|
||||
import numpy as np
|
||||
import tensorflow as tf
|
||||
from datasets import load_dataset, load_metric
|
||||
from datasets import load_dataset
|
||||
|
||||
import evaluate
|
||||
import transformers
|
||||
from transformers import (
|
||||
AutoConfig,
|
||||
@@ -366,7 +367,7 @@ def main():
|
||||
# endregion
|
||||
|
||||
# region Metric function
|
||||
metric = load_metric("glue", data_args.task_name)
|
||||
metric = evaluate.load("glue", data_args.task_name)
|
||||
|
||||
def compute_metrics(preds, label_ids):
|
||||
preds = preds["logits"]
|
||||
|
||||
Reference in New Issue
Block a user