Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the issue of errors in fully silent sentences during evaluation. #1080

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

drawfish
Copy link

When recognizing, if a sentence is completely silent, blank skip will reduce all frame. Exception occurs:
Traceback (most recent call last):
File "/data/k2/icefall/egs/xxxx/Rework/./pruned_transducer_stateless7_ctc_bs/ctc_guide_decode_bs.py", line 847, in
main()
File "/data/k2/miniconda3/envs/k2-1080ti/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "/data/k2/icefall/egs/xxxx/Rework/./pruned_transducer_stateless7_ctc_bs/ctc_guide_decode_bs.py", line 828, in main
results_dict = decode_dataset(
File "/data/k2/icefall/egs/xxxx/Rework/./pruned_transducer_stateless7_ctc_bs/ctc_guide_decode_bs.py", line 571, in decode_dataset
hyps_dict = decode_one_batch(
File "/data/k2/icefall/egs/xxxx/Rework/./pruned_transducer_stateless7_ctc_bs/ctc_guide_decode_bs.py", line 464, in decode_one_batch
hyp_tokens = greedy_search_batch(
File "/data/k2/icefall/egs/xxxx/Rework/pruned_transducer_stateless7_ctc_bs/beam_search.py", line 633, in greedy_search_batch
packed_encoder_out = torch.nn.utils.rnn.pack_padded_sequence(
File "/data/k2/miniconda3/envs/k2-1080ti/lib/python3.9/site-packages/torch/nn/utils/rnn.py", line 262, in pack_padded_sequence
_VF._pack_padded_sequence(input, lengths, batch_first)
RuntimeError: Length of all samples has to be greater than 0, but found an element in 'lengths' that is <= 0

Add code to fix (ensure at least one frame exist after frame reduce).

@csukuangfj
Copy link
Collaborator

@yfyeung Could you help review this PR?

…reducer.py

Co-authored-by: Fangjun Kuang <csukuangfj@gmail.com>
@yfyeung
Copy link
Collaborator

yfyeung commented May 22, 2023

@drawfish Thanks for your suggestion.
This model is in the LibriSpeech, whose test set does not have entirely silent sentences.
IMO, you should modify the code of the export model.

@csukuangfj
Copy link
Collaborator

@yfyeung

Shall we merge this? Do you have any other comments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants