Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRG] Clean up assertion code #224

Merged
merged 2 commits into from
Sep 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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