-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Shallow fusion in modified_beam_search (#630)
* Add utility for shallow fusion * test batch size == 1 without shallow fusion * Use shallow fusion for modified-beam-search * Modified beam search with ngram rescoring * Fix code according to review Co-authored-by: Fangjun Kuang <[email protected]>
- Loading branch information
1 parent
c30b8d3
commit 9b671e1
Showing
6 changed files
with
476 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
lang_dir=data/lang_bpe_500 | ||
|
||
for ngram in 2 3 5; do | ||
if [ ! -f $lang_dir/${ngram}gram.arpa ]; then | ||
./shared/make_kn_lm.py \ | ||
-ngram-order ${ngram} \ | ||
-text $lang_dir/transcript_tokens.txt \ | ||
-lm $lang_dir/${ngram}gram.arpa | ||
fi | ||
|
||
if [ ! -f $lang_dir/${ngram}gram.fst.txt ]; then | ||
python3 -m kaldilm \ | ||
--read-symbol-table="$lang_dir/tokens.txt" \ | ||
--disambig-symbol='#0' \ | ||
--max-order=${ngram} \ | ||
$lang_dir/${ngram}gram.arpa > $lang_dir/${ngram}gram.fst.txt | ||
fi | ||
done |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,3 +65,5 @@ | |
subsequent_chunk_mask, | ||
write_error_stats, | ||
) | ||
|
||
from .ngram_lm import NgramLm, NgramLmStateCost |
Oops, something went wrong.