Spaces:
Runtime error
Runtime error
update
Browse files- loss_metric.py +3 -2
loss_metric.py
CHANGED
@@ -51,7 +51,7 @@ Examples:
|
|
51 |
|
52 |
|
53 |
@evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
|
54 |
-
class
|
55 |
"""Calculation of the cross-entropy loss function using the huggingface evaluate module."""
|
56 |
|
57 |
def _info(self):
|
@@ -73,8 +73,9 @@ class loss_metric(evaluate.Metric):
|
|
73 |
reference_urls=["http://path.to.reference.url/new_module"]
|
74 |
)
|
75 |
|
76 |
-
def _compute(self, predictions
|
77 |
"""Returns the scores"""
|
|
|
78 |
loss_func = nn.CrossEntropyLoss()
|
79 |
loss = loss_func(predictions, references)
|
80 |
|
|
|
51 |
|
52 |
|
53 |
@evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
|
54 |
+
class LossMetric(evaluate.Metric):
|
55 |
"""Calculation of the cross-entropy loss function using the huggingface evaluate module."""
|
56 |
|
57 |
def _info(self):
|
|
|
73 |
reference_urls=["http://path.to.reference.url/new_module"]
|
74 |
)
|
75 |
|
76 |
+
def _compute(self, predictions, references):
|
77 |
"""Returns the scores"""
|
78 |
+
print(predictions)
|
79 |
loss_func = nn.CrossEntropyLoss()
|
80 |
loss = loss_func(predictions, references)
|
81 |
|