Skip to content
Open
Show file tree
Hide file tree
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
19 changes: 8 additions & 11 deletions nemo/collections/asr/parts/utils/streaming_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

import copy
import logging
from nemo.utils import logging
import math
import os
from dataclasses import dataclass
Expand Down Expand Up @@ -55,11 +55,8 @@ def print_alignment(alignment):
if m > 0:
n = len(alignment[0])
for i in range(m):
for j in range(n):
if j == 0:
print(f"{i:4d} |", end=" ")
print(f"{alignment[i][j]}", end=" ")
print()
row = f"{i:4d} | " + " ".join(str(alignment[i][j]) for j in range(n))
logging.debug(row)


def write_lcs_alignment_to_pickle(alignment, filepath, extras=None):
Expand Down Expand Up @@ -292,7 +289,7 @@ def longest_common_subsequence_merge(X, Y, filepath=None):
"slice_idx": result_idx,
}
write_lcs_alignment_to_pickle(LCSuff, filepath=filepath, extras=extras)
print("Wrote alignemnt to :", filepath)
logging.debug("Wrote alignemnt to : " + filepath)

return result_idx, LCSuff

Expand Down Expand Up @@ -1066,7 +1063,7 @@ def __init__(
except Exception:
self.eos_id = -1

print("Performing Stateful decoding :", self.stateful_decoding)
logging.info(f"Performing Stateful decoding : {self.stateful_decoding}")

if self.target_lang_id is not None:
logging.info("Using target language ID")
Expand Down Expand Up @@ -1962,7 +1959,7 @@ def transcribe(
if not keep_logits:
return hypothesis

print("keep_logits=True is not supported for MultiTaskAEDFrameBatchInfer. Returning empty logits.")
logging.warning("keep_logits=True is not supported for MultiTaskAEDFrameBatchInfer. Returning empty logits.")
return hypothesis, []

def _join_hypotheses(self, hypotheses, timestamps=False):
Expand Down Expand Up @@ -2102,7 +2099,7 @@ def transcribe(
if not keep_logits:
return hypothesis

print("keep_logits=True is not supported for FrameBatchChunkedRNNT. Returning empty logits.")
logging.warning("keep_logits=True is not supported for FrameBatchChunkedRNNT. Returning empty logits.")
return hypothesis, []


Expand Down Expand Up @@ -2159,7 +2156,7 @@ def transcribe(
if not keep_logits:
return hypothesis

print("keep_logits=True is not supported for FrameBatchChunkedCTC. Returning empty logits.")
logging.warning("keep_logits=True is not supported for FrameBatchChunkedCTC. Returning empty logits.")
return hypothesis, []


Expand Down
10 changes: 5 additions & 5 deletions nemo/collections/asr/parts/utils/transcribe_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def get_buffered_pred_feat_rnnt(
if manifest:
filepaths = []
with open(manifest, "r", encoding='utf_8') as mfst_f:
print("Parsing manifest files...")
logging.info("Parsing manifest files...")
for L in mfst_f:
L = L.strip()
if not L:
Expand Down Expand Up @@ -202,13 +202,13 @@ def get_buffered_pred_feat_rnnt(

if os.environ.get('DEBUG', '0') in ('1', 'y', 't'):
if len(refs) == 0:
print("ground-truth text does not present!")
logging.warning("ground-truth text does not present!")
for hyp in hyps:
print("hyp:", hyp)
logging.debug("hyp: " + str(hyp))
else:
for hyp, ref in zip(hyps, refs):
print("hyp:", hyp)
print("ref:", ref)
logging.debug("hyp: " + str(hyp))
logging.debug("ref: " + str(ref))

wrapped_hyps = wrap_transcription(hyps)
return wrapped_hyps
Expand Down
6 changes: 3 additions & 3 deletions nemo/collections/asr/parts/utils/vad_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,12 +954,12 @@ def vad_tune_threshold_on_dev(
best_threshold = param
optimal_scores = all_perf[str(param)]
min_score = score
print("Current best", best_threshold, optimal_scores)
logging.info(f"Current best {best_threshold} {optimal_scores}")

except RuntimeError as e:
print(f"Pass {param}, with error {e}")
logging.warning(f"Pass {param}, with error {e}")
except pd.errors.EmptyDataError as e1:
print(f"Pass {param}, with error {e1}")
logging.warning(f"Pass {param}, with error {e1}")

return best_threshold, optimal_scores

Expand Down
Loading