[ASR] Add missing Python 3 type hints to transcribe_utils.py#15707
Open
shivansh023023 wants to merge 1 commit into
Open
[ASR] Add missing Python 3 type hints to transcribe_utils.py#15707shivansh023023 wants to merge 1 commit into
shivansh023023 wants to merge 1 commit into
Conversation
Adds complete type annotations to public functions in nemo/collections/asr/parts/utils/transcribe_utils.py as required by CONTRIBUTING.md: 'Use Python 3 type hints for every class and method exposed to the user.' Changes: - Added Dict to typing imports - get_buffered_pred_feat_rnnt: manifest, filepaths, target_lang_id -> Optional[...] - get_buffered_pred_feat_multitaskAED: manifest, filepaths -> Optional[...] - restore_transcription_order: return type list -> Union[List, Tuple] - normalize_timestamp_output: dict -> Dict, added -> Dict return type - write_transcription: filepaths -> Optional[List[str]] - compute_metrics_per_sample: output_manifest_path -> Optional[str] - PunctuationCapitalization.__init__: added -> None return type No logic changes — annotations only. Signed-off-by: Hackathon User <hackathon@example.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds complete Python 3 type annotations to public functions in
nemo/collections/asr/parts/utils/transcribe_utils.py, as required byCONTRIBUTING.md: "Use Python 3 type hints for every class and method exposed to the user."
Collection: ASR
Changelog
Dictto the existingtypingimportsget_buffered_pred_feat_rnnt:manifest,filepaths,target_lang_id→Optional[...]get_buffered_pred_feat_multitaskAED:manifest,filepaths→Optional[...]restore_transcription_order: return typelist→Union[List, Tuple]normalize_timestamp_output:timestamps: dict→Dict, added-> Dictreturn typewrite_transcription:filepaths→Optional[List[str]]compute_metrics_per_sample:output_manifest_path→Optional[str]PunctuationCapitalization.__init__: added-> Nonereturn typeUsage
No API changes. Type hints are purely additive and improve IDE autocompletion
and static analysis for downstream users subclassing or calling these utilities.
Before your PR is "Ready for review"
Pre checks:
PR Type:
Additional Information
blackandisortchecks pass locallyspeech_to_text_finetune.py