Skip to content

Commit

Permalink
ExternSprintDataset, more Python3 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
albertz committed May 13, 2024
1 parent ece6efc commit 5183a28
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions returnn/datasets/sprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,9 @@ def add_new_data(self, features, targets=None, segment_name=None):
self.reduce_target_factor,
)
if "speaker_name" in targets:
targets["speaker_name"] = targets["speaker_name"].decode("utf8").strip()
targets["speaker_name"] = targets["speaker_name"].strip()
if "orth" in targets:
targets["orth"] = targets["orth"].decode("utf8").strip()
targets["orth"] = targets["orth"].strip()
if "orth" in targets and self.orth_post_process:
targets["orth"] = self.orth_post_process(targets["orth"])
if self.bpe:
Expand Down Expand Up @@ -975,11 +975,7 @@ def _reader_thread_proc(self, child_pid, epoch):
if data_type == "data":
seq_count += 1
segment_name, features, targets = args
if segment_name is not None:
segment_name = segment_name.decode("utf8")
assert isinstance(features, numpy.ndarray)
if isinstance(targets, dict):
targets = {key.decode("utf8"): value for (key, value) in targets.items()}
self.add_new_data(
numpy_copy_and_set_unused(features),
numpy_copy_and_set_unused(targets),
Expand Down

0 comments on commit 5183a28

Please sign in to comment.