Skip to content

Commit

Permalink
bugfix (missing SetFeatureDim())
Browse files Browse the repository at this point in the history
  • Loading branch information
KarelVesely84 committed Mar 14, 2024
1 parent 468fe1c commit 96c2a9f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sherpa-onnx/csrc/keyword-spotter-transducer-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>")) {
unk_id_ = sym_["<unk>"];
}
Expand All @@ -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>")) {
unk_id_ = sym_["<unk>"];
}
Expand Down
6 changes: 6 additions & 0 deletions sherpa-onnx/csrc/online-recognizer-transducer-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <utility>
#include <vector>

#include <iostream>

#if __ANDROID_API__ >= 9
#include <strstream>

Expand Down Expand Up @@ -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>")) {
unk_id_ = sym_["<unk>"];
}
Expand Down Expand Up @@ -153,6 +158,7 @@ class OnlineRecognizerTransducerImpl : public OnlineRecognizerImpl {
#endif

std::unique_ptr<OnlineStream> CreateStream() const override {
std::cout << "DEBUG, CreateStream(): " << config_.feat_config.ToString() << std::endl;
auto stream =
std::make_unique<OnlineStream>(config_.feat_config, hotwords_graph_);
InitOnlineStream(stream.get());
Expand Down

0 comments on commit 96c2a9f

Please sign in to comment.