k2-fsa / sherpa

Speech-to-text server framework with next-gen Kaldi
https://k2-fsa.github.io/sherpa
Apache License 2.0
474 stars 97 forks source link

Replace FbankOptions with FeatureConfig to support 'normalize_samples' option #546

Closed megazone87 closed 4 months ago

megazone87 commented 4 months ago

By setting --normalize-samples=false, you can invoke the model trained with Kaldi-style features.

Note: sherpa-offline supports setting this option from the command line, while sherpa-online does not support it. This PR is to enable command line setting support for sherpa-online.

Note 2: There are no changes related to pybind, server/client, triton (maybe) submitted here. If you think that 'Replace FbankOptions with FeatureConfig' is worth it (for this requirement or in the future), I am willing to make the necessary changes.

csukuangfj commented 4 months ago

Thank you for your first-time contribution!

Looks good to me. Will merge it after the CI tests get passed.

csukuangfj commented 4 months ago

Could you build and test it locally?

The CI gives compilation errors:

[ 74%] Built target sherpa-online-websocket-client-microphone
/home/runner/work/sherpa/sherpa/sherpa/csrc/test-online-stream.cc: In member function ‘virtual void sherpa::OnlineStream_Test_Test::TestBody()’:
/home/runner/work/sherpa/sherpa/sherpa/csrc/test-online-stream.cc:35:40: error: no matching function for call to ‘sherpa::OnlineStream::OnlineStream(kaldifeat::FbankOptions&)’
   35 |   OnlineStream s(feat_config.fbank_opts);
      |                                        ^
In file included from /home/runner/work/sherpa/sherpa/sherpa/csrc/test-online-stream.cc:23:
/home/runner/work/sherpa/sherpa/sherpa/cpp_api/online-stream.h:61:12: note: candidate: ‘sherpa::OnlineStream::OnlineStream(const sherpa::FeatureConfig&, sherpa::ContextGraphPtr)’
   61 |   explicit OnlineStream(const FeatureConfig &feat_config,
      |            ^~~~~~~~~~~~
/home/runner/work/sherpa/sherpa/sherpa/cpp_api/online-stream.h:61:46: note:   no known conversion for argument 1 from ‘kaldifeat::FbankOptions’ to ‘const sherpa::FeatureConfig&’
   61 |   explicit OnlineStream(const FeatureConfig &feat_config,
      |                         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~

Please see https://github.com/k2-fsa/sherpa/actions/runs/8063891860/job/22026637645

megazone87 commented 4 months ago

I have made the changes and tested them locally. Can you restart the actions tests?

csukuangfj commented 4 months ago

Thanks!