Skip to content

Commit

Permalink
Merge pull request #224 from persephone-tools/bugfix-floating-point-c…
Browse files Browse the repository at this point in the history
…ompare

[MRG] Clean up assertion code
  • Loading branch information
oadams committed Sep 21, 2019
2 parents b4ce92f + 91e745b commit 1e31f80
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion persephone/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import inspect
import itertools
import logging
import math
import os
from pathlib import Path
import sys
Expand Down Expand Up @@ -290,7 +291,10 @@ def eval(self, restore_model_path: Optional[str]=None) -> None:
print(" ".join(ref), file=refs_f)

test_per = utils.batch_per(hyps, refs)
assert test_per == test_ler
if not math.isclose(test_per, test_ler, rel_tol=1e-07):
logger.warning("The label error rate from Tensorflow doesn't exactly"
"match the phoneme error rate calculated in persephone"
"Tensorflow %f, Persephone %f", test_ler, test_per)
with open(os.path.join(hyps_dir, "test_per"), "w",
encoding=ENCODING) as per_f:
print("LER: %f" % (test_ler), file=per_f)
Expand Down

0 comments on commit 1e31f80

Please sign in to comment.