Fix speed report in table

This commit is contained in:
Matthew Honnibal 2020-09-13 17:39:31 +02:00
parent 744df9814a
commit b693d2d224
2 changed files with 7 additions and 15 deletions

View File

@ -1281,7 +1281,7 @@ class Language:
util.logger.debug(doc)
eg.predicted = doc
results = scorer.score(examples)
n_words = sum(len(eg.predicted) for eg in examples)
n_words = sum(len(doc) for doc in docs)
results["speed"] = n_words / (end_time - start_time)
return results

View File

@ -36,20 +36,12 @@ def console_logger():
keys=list(info["losses"].keys()),
)
) from None
try:
scores = [
"{0:.2f}".format(float(info["other_scores"].get(col, 0.0)) * 100)
for col in score_cols
]
except KeyError as e:
raise KeyError(
Errors.E983.format(
dict="scores (other)",
key=str(e),
keys=list(info["other_scores"].keys()),
)
) from None
scores = []
for col in score_cols:
score = float(info["other_scores"].get(col, 0.0)))
if col != "speed":
score *= 100
scores.append("{0:.2f}".format(score)
data = (
[info["epoch"], info["step"]]
+ losses