Re-implement LM rescore for online transducer (#1231)

Co-authored-by: Martins Kronis <martins.kuznecovs@tilde.lv>
This commit is contained in:
SilverSulfide
2024-09-06 05:01:25 +03:00
committed by GitHub
parent 1f29e4a1a9
commit 888f74bf3c
11 changed files with 175 additions and 31 deletions

View File

@@ -21,13 +21,16 @@ class OnlineTransducerModifiedBeamSearchDecoder
OnlineTransducerModifiedBeamSearchDecoder(OnlineTransducerModel *model,
OnlineLM *lm,
int32_t max_active_paths,
float lm_scale, int32_t unk_id,
float lm_scale,
bool shallow_fusion,
int32_t unk_id,
float blank_penalty,
float temperature_scale)
: model_(model),
lm_(lm),
max_active_paths_(max_active_paths),
lm_scale_(lm_scale),
shallow_fusion_(shallow_fusion),
unk_id_(unk_id),
blank_penalty_(blank_penalty),
temperature_scale_(temperature_scale) {}
@@ -50,6 +53,7 @@ class OnlineTransducerModifiedBeamSearchDecoder
int32_t max_active_paths_;
float lm_scale_; // used only when lm_ is not nullptr
bool shallow_fusion_; // used only when lm_ is not nullptr
int32_t unk_id_;
float blank_penalty_;
float temperature_scale_;