Fix various language binding APIs for tdnn and whisper models (#278)
This commit is contained in:
@@ -15,13 +15,23 @@ func main() {
|
||||
log.SetFlags(log.LstdFlags | log.Lmicroseconds)
|
||||
|
||||
config := sherpa.OfflineRecognizerConfig{}
|
||||
config.FeatConfig = sherpa.FeatureConfig{SampleRate: 16000, FeatureDim: 80}
|
||||
|
||||
flag.StringVar(&config.ModelConfig.Transducer.Encoder, "encoder", "", "Path to the encoder model")
|
||||
flag.StringVar(&config.ModelConfig.Transducer.Decoder, "decoder", "", "Path to the decoder model")
|
||||
flag.IntVar(&config.FeatConfig.SampleRate, "sample-rate", 16000, "Sample rate of the data used to train the model")
|
||||
flag.IntVar(&config.FeatConfig.FeatureDim, "feat-dim", 80, "Dimension of the features used to train the model")
|
||||
|
||||
flag.StringVar(&config.ModelConfig.Transducer.Encoder, "encoder", "", "Path to the transducer encoder model")
|
||||
flag.StringVar(&config.ModelConfig.Transducer.Decoder, "decoder", "", "Path to the transducer decoder model")
|
||||
flag.StringVar(&config.ModelConfig.Transducer.Joiner, "joiner", "", "Path to the joiner model")
|
||||
|
||||
flag.StringVar(&config.ModelConfig.Paraformer.Model, "paraformer", "", "Path to the paraformer model")
|
||||
|
||||
flag.StringVar(&config.ModelConfig.NemoCTC.Model, "nemo-ctc", "", "Path to the NeMo CTC model")
|
||||
|
||||
flag.StringVar(&config.ModelConfig.Whisper.Encoder, "whisper-encoder", "", "Path to the whisper encoder model")
|
||||
flag.StringVar(&config.ModelConfig.Whisper.Decoder, "whisper-decoder", "", "Path to the whisper decoder model")
|
||||
|
||||
flag.StringVar(&config.ModelConfig.Tdnn.Model, "tdnn-model", "", "Path to the tdnn model")
|
||||
|
||||
flag.StringVar(&config.ModelConfig.Tokens, "tokens", "", "Path to the tokens file")
|
||||
flag.IntVar(&config.ModelConfig.NumThreads, "num-threads", 1, "Number of threads for computing")
|
||||
flag.IntVar(&config.ModelConfig.Debug, "debug", 0, "Whether to show debug message")
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# to download the model
|
||||
# before you run this script.
|
||||
#
|
||||
# You can switch to a different online model if you need
|
||||
# You can switch to a different offline model if you need
|
||||
|
||||
./non-streaming-decode-files \
|
||||
--nemo-ctc ./sherpa-onnx-nemo-ctc-en-conformer-medium/model.onnx \
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
# to download the model
|
||||
# before you run this script.
|
||||
#
|
||||
# You can switch to a different online model if you need
|
||||
|
||||
./non-streaming-decode-files \
|
||||
--paraformer ./sherpa-onnx-paraformer-zh-2023-03-28/model.int8.onnx \
|
||||
|
||||
14
go-api-examples/non-streaming-decode-files/run-tdnn-yesno.sh
Executable file
14
go-api-examples/non-streaming-decode-files/run-tdnn-yesno.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Please refer to
|
||||
# https://k2-fsa.github.io/sherpa/onnx/pretrained_models/offline-ctc/yesno/index.html
|
||||
# to download the model
|
||||
# before you run this script.
|
||||
#
|
||||
|
||||
./non-streaming-decode-files \
|
||||
--sample-rate=8000 \
|
||||
--feat-dim=23 \
|
||||
--tokens=./sherpa-onnx-tdnn-yesno/tokens.txt \
|
||||
--tdnn-model=./sherpa-onnx-tdnn-yesno/model-epoch-14-avg-2.onnx \
|
||||
./sherpa-onnx-tdnn-yesno/test_wavs/0_0_0_1_0_0_0_1.wav
|
||||
@@ -5,7 +5,7 @@
|
||||
# to download the model
|
||||
# before you run this script.
|
||||
#
|
||||
# You can switch to a different online model if you need
|
||||
# You can switch to a different offline model if you need
|
||||
|
||||
./non-streaming-decode-files \
|
||||
--encoder ./sherpa-onnx-zipformer-en-2023-06-26/encoder-epoch-99-avg-1.onnx \
|
||||
|
||||
15
go-api-examples/non-streaming-decode-files/run-whisper.sh
Executable file
15
go-api-examples/non-streaming-decode-files/run-whisper.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Please refer to
|
||||
# https://k2-fsa.github.io/sherpa/onnx/pretrained_models/whisper/tiny.en.html
|
||||
# to download the model
|
||||
# before you run this script.
|
||||
#
|
||||
# You can switch to a different offline model if you need
|
||||
|
||||
./non-streaming-decode-files \
|
||||
--whisper-encoder=./sherpa-onnx-whisper-tiny.en/tiny.en-encoder.onnx \
|
||||
--whisper-decoder=./sherpa-onnx-whisper-tiny.en/tiny.en-decoder.onnx \
|
||||
--tokens=./sherpa-onnx-whisper-tiny.en/tiny.en-tokens.txt \
|
||||
./sherpa-onnx-whisper-tiny.en/test_wavs/0.wav
|
||||
|
||||
Reference in New Issue
Block a user