Spaces:
Sleeping
Sleeping
fix output type.
Browse files- lingo_judge_metric.py +11 -1
lingo_judge_metric.py
CHANGED
@@ -32,6 +32,15 @@ Args:
|
|
32 |
Returns:
|
33 |
`scores` (list of float): Score indicating truthfulness.
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
"""
|
36 |
|
37 |
|
@@ -61,4 +70,5 @@ class LingoJudgeMetric(evaluate.Metric):
|
|
61 |
|
62 |
def _compute(self, questions, predictions, references):
|
63 |
"""Returns the scores"""
|
64 |
-
|
|
|
|
32 |
Returns:
|
33 |
`scores` (list of float): Score indicating truthfulness.
|
34 |
|
35 |
+
Examples:
|
36 |
+
|
37 |
+
Example 1
|
38 |
+
>>> metric = evaluate.load("maysonma/lingo_judge_metric")
|
39 |
+
>>> questions = ["Are there any traffic lights present? If yes, what is their color?"]
|
40 |
+
>>> references = [["Yes, green."]]
|
41 |
+
>>> predictions = ["No."]
|
42 |
+
>>> results = metric.compute(questions=questions, predictions=predictions, references=references)
|
43 |
+
>>> print(results)
|
44 |
"""
|
45 |
|
46 |
|
|
|
70 |
|
71 |
def _compute(self, questions, predictions, references):
|
72 |
"""Returns the scores"""
|
73 |
+
scores = self.scorer.compute(questions, references, predictions)
|
74 |
+
return scores.cpu().tolist()
|