Skip to content
Snippets Groups Projects
Commit 741addd6 authored by spmohanty's avatar spmohanty
Browse files

Load sacrebleu on first use

parent 28e1c881
No related branches found
No related tags found
No related merge requests found
......@@ -5,8 +5,7 @@ import evaluate
from typing import List
print("\nsacrebleu loading...")
sacrebleu = evaluate.load("sacrebleu")
sacrebleu = None
def accuracy(prediction: int, truth: int):
......@@ -107,6 +106,11 @@ def ndcg_eval(relevance_scores: List[float], truth: List[float]):
def bleu(generation, truth, jp=False):
global sacrebleu
if sacrebleu is None:
print("\nsacrebleu loading...")
sacrebleu = evaluate.load("sacrebleu")
generation = generation.lstrip("\n").rstrip("\n").split("\n")[0]
candidate = [generation]
reference = [[truth]]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment