Add C++ runtime for Tele-AI/TeleSpeech-ASR (#970)
This commit is contained in:
@@ -163,6 +163,22 @@ def get_models():
|
||||
|
||||
ls -lh
|
||||
|
||||
popd
|
||||
""",
|
||||
),
|
||||
Model(
|
||||
model_name="sherpa-onnx-telespeech-ctc-int8-zh-2024-06-04",
|
||||
idx=11,
|
||||
lang="zh",
|
||||
short_name="telespeech",
|
||||
cmd="""
|
||||
pushd $model_name
|
||||
|
||||
rm -rfv test_wavs
|
||||
rm test.py
|
||||
|
||||
ls -lh
|
||||
|
||||
popd
|
||||
""",
|
||||
),
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace SherpaOnnx
|
||||
ModelType = "";
|
||||
ModelingUnit = "cjkchar";
|
||||
BpeVocab = "";
|
||||
TeleSpeechCtc = "";
|
||||
}
|
||||
public OfflineTransducerModelConfig Transducer;
|
||||
public OfflineParaformerModelConfig Paraformer;
|
||||
@@ -50,5 +51,8 @@ namespace SherpaOnnx
|
||||
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string BpeVocab;
|
||||
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string TeleSpeechCtc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ mkdir -p linux macos windows-x64 windows-x86
|
||||
linux_wheel_filename=sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
|
||||
linux_wheel=$src_dir/$linux_wheel_filename
|
||||
|
||||
macos_wheel_filename=sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-macosx_11_0_x86_64.whl
|
||||
macos_wheel_filename=sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-macosx_11_0_universal2.whl
|
||||
macos_wheel=$src_dir/$macos_wheel_filename
|
||||
|
||||
windows_x64_wheel_filename=sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-win_amd64.whl
|
||||
@@ -61,7 +61,7 @@ if [ ! -f $src_dir/linux/libsherpa-onnx-core.so ]; then
|
||||
fi
|
||||
|
||||
if [ ! -f $src_dir/macos/libsherpa-onnx-core.dylib ]; then
|
||||
echo "---macOS x86_64---"
|
||||
echo "--- macOS x86_64/arm64 universal2---"
|
||||
cd macos
|
||||
mkdir -p wheel
|
||||
cd wheel
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
../../../../go-api-examples/non-streaming-decode-files/run-telespeech-ctc.sh
|
||||
@@ -381,8 +381,9 @@ type OfflineModelConfig struct {
|
||||
// Optional. Specify it for faster model initialization.
|
||||
ModelType string
|
||||
|
||||
ModelingUnit string // Optional. cjkchar, bpe, cjkchar+bpe
|
||||
BpeVocab string // Optional.
|
||||
ModelingUnit string // Optional. cjkchar, bpe, cjkchar+bpe
|
||||
BpeVocab string // Optional.
|
||||
TeleSpeechCtc string // Optional.
|
||||
}
|
||||
|
||||
// Configuration for the offline/non-streaming recognizer.
|
||||
@@ -477,6 +478,9 @@ func NewOfflineRecognizer(config *OfflineRecognizerConfig) *OfflineRecognizer {
|
||||
c.model_config.bpe_vocab = C.CString(config.ModelConfig.BpeVocab)
|
||||
defer C.free(unsafe.Pointer(c.model_config.bpe_vocab))
|
||||
|
||||
c.model_config.telespeech_ctc = C.CString(config.ModelConfig.TeleSpeechCtc)
|
||||
defer C.free(unsafe.Pointer(c.model_config.telespeech_ctc))
|
||||
|
||||
c.lm_config.model = C.CString(config.LmConfig.Model)
|
||||
defer C.free(unsafe.Pointer(c.lm_config.model))
|
||||
|
||||
|
||||
@@ -128,6 +128,7 @@ static SherpaOnnxOfflineModelConfig GetOfflineModelConfig(Napi::Object obj) {
|
||||
SHERPA_ONNX_ASSIGN_ATTR_STR(model_type, modelType);
|
||||
SHERPA_ONNX_ASSIGN_ATTR_STR(modeling_unit, modelingUnit);
|
||||
SHERPA_ONNX_ASSIGN_ATTR_STR(bpe_vocab, bpeVocab);
|
||||
SHERPA_ONNX_ASSIGN_ATTR_STR(telespeech_ctc, teleSpeechCtc);
|
||||
|
||||
return c;
|
||||
}
|
||||
@@ -242,6 +243,10 @@ CreateOfflineRecognizerWrapper(const Napi::CallbackInfo &info) {
|
||||
delete[] c.model_config.bpe_vocab;
|
||||
}
|
||||
|
||||
if (c.model_config.telespeech_ctc) {
|
||||
delete[] c.model_config.telespeech_ctc;
|
||||
}
|
||||
|
||||
if (c.lm_config.model) {
|
||||
delete[] c.lm_config.model;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user