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) util.logger.debug(doc)
eg.predicted = doc eg.predicted = doc
results = scorer.score(examples) 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) results["speed"] = n_words / (end_time - start_time)
return results return results

View File

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