From 96c2a9f9a5b4ce3d4e9561f014b78bc3457b796d Mon Sep 17 00:00:00 2001 From: Karel Vesely Date: Thu, 14 Mar 2024 12:19:04 +0100 Subject: [PATCH] bugfix (missing SetFeatureDim()) --- sherpa-onnx/csrc/keyword-spotter-transducer-impl.h | 6 ++++++ sherpa-onnx/csrc/online-recognizer-transducer-impl.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/sherpa-onnx/csrc/keyword-spotter-transducer-impl.h b/sherpa-onnx/csrc/keyword-spotter-transducer-impl.h index ef22a99848..2d9964c988 100644 --- a/sherpa-onnx/csrc/keyword-spotter-transducer-impl.h +++ b/sherpa-onnx/csrc/keyword-spotter-transducer-impl.h @@ -68,6 +68,9 @@ class KeywordSpotterTransducerImpl : public KeywordSpotterImpl { : config_(config), model_(OnlineTransducerModel::Create(config.model_config)), sym_(config.model_config.tokens) { + + model_->SetFeatureDim(config.feat_config.feature_dim); + if (sym_.contains("")) { unk_id_ = sym_[""]; } @@ -85,6 +88,9 @@ class KeywordSpotterTransducerImpl : public KeywordSpotterImpl { : config_(config), model_(OnlineTransducerModel::Create(mgr, config.model_config)), sym_(mgr, config.model_config.tokens) { + + model_->SetFeatureDim(config.feat_config.feature_dim); + if (sym_.contains("")) { unk_id_ = sym_[""]; } diff --git a/sherpa-onnx/csrc/online-recognizer-transducer-impl.h b/sherpa-onnx/csrc/online-recognizer-transducer-impl.h index 3fc018daa4..7908ec8eeb 100644 --- a/sherpa-onnx/csrc/online-recognizer-transducer-impl.h +++ b/sherpa-onnx/csrc/online-recognizer-transducer-impl.h @@ -14,6 +14,8 @@ #include #include +#include + #if __ANDROID_API__ >= 9 #include @@ -122,6 +124,9 @@ class OnlineRecognizerTransducerImpl : public OnlineRecognizerImpl { model_(OnlineTransducerModel::Create(mgr, config.model_config)), sym_(mgr, config.model_config.tokens), endpoint_(config_.endpoint_config) { + + model_->SetFeatureDim(config.feat_config.feature_dim); + if (sym_.contains("")) { unk_id_ = sym_[""]; } @@ -153,6 +158,7 @@ class OnlineRecognizerTransducerImpl : public OnlineRecognizerImpl { #endif std::unique_ptr CreateStream() const override { + std::cout << "DEBUG, CreateStream(): " << config_.feat_config.ToString() << std::endl; auto stream = std::make_unique(config_.feat_config, hotwords_graph_); InitOnlineStream(stream.get());