Skip to content

Commit cc33886

Browse files
committed
refactor
Signed-off-by: stevehuang52 <[email protected]>
1 parent 8b15bf2 commit cc33886

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

nemo_asr/calc_rtf_chunk.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ def main():
143143
asr_model.eval()
144144
asr_model._prepare_for_export()
145145

146-
preprocessor = extract_preprocessor(asr_model, DEVICE)
147146
input_example, input_example_length = get_samples(WAV, total_audio_len)
148147

149148
frame_asr = None
@@ -182,15 +181,12 @@ def main():
182181
with torch.cuda.amp.autocast(dtype=torch.bfloat16):
183182
with torch.no_grad():
184183
for i in tqdm(range(nbatches + warmup_batches)):
184+
frame_asr.reset()
185185
start = time.time()
186186
if decoding_type == 'ctc':
187-
frame_asr.reset()
188187
setup_ctc_chunk_infer(frame_asr, input_example)
189-
hyp = frame_asr.transcribe()
190188
elif decoding_type == 'rnnt':
191-
frame_asr.reset()
192189
setup_rnnt_chunk_infer(frame_asr, input_example)
193-
hyp = frame_asr.transcribe()
194190
elif decoding_type == 'aed':
195191
meta = {
196192
'audio_filepath': WAV,
@@ -201,12 +197,10 @@ def main():
201197
'pnc': 'yes',
202198
'answer': 'nvidia',
203199
}
204-
frame_asr.reset()
205200
setup_aed_chunk_infer(frame_asr, input_example, meta)
206-
hyp = frame_asr.transcribe()
207201
else:
208202
raise ValueError(f'Invalid decoding type: {decoding_type}')
209-
203+
hyp = frame_asr.transcribe()
210204
torch.cuda.synchronize()
211205
end = time.time()
212206
if i >= warmup_batches:

0 commit comments

Comments
 (0)