Replace numpy floats in evaluate and update

This commit is contained in:
Matthew Honnibal 2024-09-14 12:55:53 +02:00
parent 0576a1ff56
commit 3d03565498
1 changed files with 2 additions and 2 deletions

View File

@ -1214,7 +1214,7 @@ class Language:
examples,
):
eg.predicted = doc
return losses
return _replace_numpy_floats(losses)
def rehearse(
self,
@ -1465,7 +1465,7 @@ class Language:
results = scorer.score(examples, per_component=per_component)
n_words = sum(len(eg.predicted) for eg in examples)
results["speed"] = n_words / (end_time - start_time)
return results
return _replace_numpy_floats(results)
def create_optimizer(self):
"""Create an optimizer, usually using the [training.optimizer] config."""