context_state is not set correctly when previous context is passed after reset (#1393)
Co-authored-by: vsd-vector <askars.salimbajevs@tilde.lv>
This commit is contained in:
@@ -382,13 +382,6 @@ class OnlineRecognizerTransducerImpl : public OnlineRecognizerImpl {
|
|||||||
// s->SetStates(model_->GetEncoderInitStates());
|
// s->SetStates(model_->GetEncoderInitStates());
|
||||||
|
|
||||||
auto r = decoder_->GetEmptyResult();
|
auto r = decoder_->GetEmptyResult();
|
||||||
if (config_.decoding_method == "modified_beam_search" &&
|
|
||||||
nullptr != s->GetContextGraph()) {
|
|
||||||
for (auto it = r.hyps.begin(); it != r.hyps.end(); ++it) {
|
|
||||||
it->second.context_state = s->GetContextGraph()->Root();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto last_result = s->GetResult();
|
auto last_result = s->GetResult();
|
||||||
// if last result is not empty, then
|
// if last result is not empty, then
|
||||||
// preserve last tokens as the context for next result
|
// preserve last tokens as the context for next result
|
||||||
@@ -401,6 +394,13 @@ class OnlineRecognizerTransducerImpl : public OnlineRecognizerImpl {
|
|||||||
r.tokens = std::move(context);
|
r.tokens = std::move(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config_.decoding_method == "modified_beam_search" &&
|
||||||
|
nullptr != s->GetContextGraph()) {
|
||||||
|
for (auto it = r.hyps.begin(); it != r.hyps.end(); ++it) {
|
||||||
|
it->second.context_state = s->GetContextGraph()->Root();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
s->SetResult(r);
|
s->SetResult(r);
|
||||||
|
|
||||||
// Note: We only update counters. The underlying audio samples
|
// Note: We only update counters. The underlying audio samples
|
||||||
|
|||||||
Reference in New Issue
Block a user