Spaces:
Running
on
Zero
Running
on
Zero
Update nemo_align.py
Browse files- nemo_align.py +4 -1
nemo_align.py
CHANGED
|
@@ -5,6 +5,7 @@ import torch
|
|
| 5 |
from nemo.utils import logging
|
| 6 |
from pathlib import Path
|
| 7 |
from viterbi_decoding import viterbi_decoding
|
|
|
|
| 8 |
|
| 9 |
BLANK_TOKEN = "<b>"
|
| 10 |
|
|
@@ -437,7 +438,9 @@ def get_start_end_for_segments(word_timestamps):
|
|
| 437 |
|
| 438 |
def align_tdt_to_ctc_timestamps(tdt_txt, model, audio_filepath):
|
| 439 |
if isinstance(model, EncDecHybridRNNTCTCModel):
|
| 440 |
-
|
|
|
|
|
|
|
| 441 |
else:
|
| 442 |
raise ValueError("Currently supporting hybrid models")
|
| 443 |
|
|
|
|
| 5 |
from nemo.utils import logging
|
| 6 |
from pathlib import Path
|
| 7 |
from viterbi_decoding import viterbi_decoding
|
| 8 |
+
from nemo.collections.asr.parts.submodules.ctc_decoding import CTCDecodingConfig
|
| 9 |
|
| 10 |
BLANK_TOKEN = "<b>"
|
| 11 |
|
|
|
|
| 438 |
|
| 439 |
def align_tdt_to_ctc_timestamps(tdt_txt, model, audio_filepath):
|
| 440 |
if isinstance(model, EncDecHybridRNNTCTCModel):
|
| 441 |
+
ctc_cfg = CTCDecodingConfig()
|
| 442 |
+
ctc_cfg.decoding = "greedy_batch"
|
| 443 |
+
model.change_decoding_strategy(decoding_cfg=ctc_cfg, decoder_type="ctc")
|
| 444 |
else:
|
| 445 |
raise ValueError("Currently supporting hybrid models")
|
| 446 |
|