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

Drop optional CTM n-best header #542

Merged
merged 2 commits into from
Sep 11, 2024
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
14 changes: 12 additions & 2 deletions returnn/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,12 @@ def run(self):
d = eval(util.uopen(self.recog_words_file.get_path(), "rt").read())
assert isinstance(d, dict), "only search output file with dict format is supported"
with util.uopen(self.out_ctm_file.get_path(), "wt") as out:
out.write(";; <name> <track> <start> <duration> <word> <confidence> [<n-best>]\n")
# Do not print optional [n-best] header, some downstream evaluation pipelines
# use the number of headers for validation. Since we do not print n-best-list
# information this validation fails and discards the entire search outputs.
#
# See https://github.com/rwth-i6/i6_core/pull/542.
out.write(";; <name> <track> <start> <duration> <word> <confidence>\n")
albertz marked this conversation as resolved.
Show resolved Hide resolved
for seg in corpus.segments():
seg_start = 0.0 if seg.start == float("inf") else seg.start
seg_end = 0.0 if seg.end == float("inf") else seg.end
Expand Down Expand Up @@ -541,7 +546,12 @@ def run(self):
else:
seq_order = d.keys()
with util.uopen(self.out_ctm_file.get_path(), "wt") as out:
out.write(";; <name> <track> <start> <duration> <word> <confidence> [<n-best>]\n")
# Do not print optional [n-best] header, some downstream evaluation pipelines
# use the number of headers for validation. Since we do not print n-best-list
# information this validation fails and discards the entire search outputs.
#
# See https://github.com/rwth-i6/i6_core/pull/542.
out.write(";; <name> <track> <start> <duration> <word> <confidence>\n")
for seg_fullname in seq_order:
assert isinstance(
seg_fullname, str
Expand Down
Loading