From e133eb5e95daa4b0740243af24831b8e9e573168 Mon Sep 17 00:00:00 2001 From: Team Infinix Dev Date: Sun, 28 Jun 2026 15:28:49 -0600 Subject: [PATCH 1/2] Add missing type hints in transcribe_utils --- .../asr/parts/utils/transcribe_utils.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/nemo/collections/asr/parts/utils/transcribe_utils.py b/nemo/collections/asr/parts/utils/transcribe_utils.py index 0e54ba280250..0b1617cfe9ab 100644 --- a/nemo/collections/asr/parts/utils/transcribe_utils.py +++ b/nemo/collections/asr/parts/utils/transcribe_utils.py @@ -18,7 +18,7 @@ from dataclasses import dataclass from pathlib import Path from tempfile import NamedTemporaryFile -from typing import List, Optional, Tuple, Union +from typing import Dict, List, Optional, Tuple, Union import torch from omegaconf import DictConfig @@ -106,9 +106,9 @@ def get_buffered_pred_feat_rnnt( delay: int, model_stride_in_secs: int, batch_size: int, - manifest: str = None, - filepaths: List[list] = None, - target_lang_id: str = None, + manifest: Optional[str] = None, + filepaths: Optional[List[list]] = None, + target_lang_id: Optional[str] = None, accelerator: Optional[str] = 'cpu', ) -> List[rnnt_utils.Hypothesis]: """ @@ -219,8 +219,8 @@ def get_buffered_pred_feat_multitaskAED( preprocessor_cfg: DictConfig, model_stride_in_secs: int, device: Union[List[int], int], - manifest: str = None, - filepaths: List[list] = None, + manifest: Optional[str] = None, + filepaths: Optional[List[list]] = None, delay: float = 0.0, timestamps: bool = False, ) -> List[rnnt_utils.Hypothesis]: @@ -390,7 +390,7 @@ def read_and_maybe_sort_manifest(path: str, try_sort: bool = False) -> List[dict return items -def restore_transcription_order(manifest_path: str, transcriptions: list) -> list: +def restore_transcription_order(manifest_path: str, transcriptions: List) -> Union[List, Tuple]: with open(manifest_path, encoding='utf-8') as f: items = [(idx, json.loads(l)) for idx, l in enumerate(f) if l.strip() != ""] if not all("duration" in item[1] and item[1]["duration"] is not None for item in items): @@ -422,7 +422,7 @@ def compute_output_filename(cfg: DictConfig, model_name: str) -> DictConfig: return cfg -def normalize_timestamp_output(timestamps: dict): +def normalize_timestamp_output(timestamps: Dict) -> Dict: """ Normalize the dictionary of timestamp values to JSON serializable values. Expects the following keys to exist - @@ -447,7 +447,7 @@ def write_transcription( transcriptions: Union[List[rnnt_utils.Hypothesis], List[List[rnnt_utils.Hypothesis]], List[str]], cfg: DictConfig, model_name: str, - filepaths: List[str] = None, + filepaths: Optional[List[str]] = None, compute_langs: bool = False, timestamps: bool = False, confidence: bool = False, @@ -560,7 +560,7 @@ def compute_metrics_per_sample( hypothesis_field: str = "pred_text", metrics: List[str] = ["wer"], punctuation_marks: List[str] = [".", ",", "?"], - output_manifest_path: str = None, + output_manifest_path: Optional[str] = None, ) -> dict: ''' Computes metrics per sample for given manifest @@ -648,7 +648,7 @@ def compute_metrics_per_sample( class PunctuationCapitalization: - def __init__(self, punctuation_marks: str): + def __init__(self, punctuation_marks: str) -> None: """ Class for text processing with punctuation and capitalization. Can be used with class TextProcessingConfig. From 3a7b4212b68c3058c59072d3ec201e72c60910d6 Mon Sep 17 00:00:00 2001 From: Team Infinix Dev Date: Sun, 28 Jun 2026 15:46:14 -0600 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Team Infinix Dev --- nemo/collections/asr/parts/utils/transcribe_utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nemo/collections/asr/parts/utils/transcribe_utils.py b/nemo/collections/asr/parts/utils/transcribe_utils.py index 0b1617cfe9ab..d1a54e080ffa 100644 --- a/nemo/collections/asr/parts/utils/transcribe_utils.py +++ b/nemo/collections/asr/parts/utils/transcribe_utils.py @@ -106,9 +106,7 @@ def get_buffered_pred_feat_rnnt( delay: int, model_stride_in_secs: int, batch_size: int, - manifest: Optional[str] = None, - filepaths: Optional[List[list]] = None, - target_lang_id: Optional[str] = None, + filepaths: Optional[List[str]] = None, accelerator: Optional[str] = 'cpu', ) -> List[rnnt_utils.Hypothesis]: """