From 9f78b36eaf50958c8aacadef1f99df36f49eab93 Mon Sep 17 00:00:00 2001 From: MahmoudAshraf97 Date: Sat, 29 Jun 2024 16:34:24 +0300 Subject: [PATCH] enable running benchmark from anywhere --- benchmark/wer_benchmark.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/benchmark/wer_benchmark.py b/benchmark/wer_benchmark.py index bf0a1e0e..b0bb633f 100644 --- a/benchmark/wer_benchmark.py +++ b/benchmark/wer_benchmark.py @@ -1,6 +1,6 @@ import argparse import json - +import os from datasets import load_dataset from evaluate import load from tqdm import tqdm @@ -26,7 +26,9 @@ # define the evaluation metric wer_metric = load("wer") -normalizer = EnglishTextNormalizer(json.load(open("normalizer.json"))) + +with open(os.path.join(os.path.dirname(__file__), "normalizer.json"), "r") as f: + normalizer = EnglishTextNormalizer(json.load(f)) def inference(batch):