Support non-streaming zipformer CTC ASR models (#2340)
This PR adds support for non-streaming Zipformer CTC ASR models across multiple language bindings, WebAssembly, examples, and CI workflows. - Introduces a new OfflineZipformerCtcModelConfig in C/C++, Python, Swift, Java, Kotlin, Go, Dart, Pascal, and C# APIs - Updates initialization, freeing, and recognition logic to include Zipformer CTC in WASM and Node.js - Adds example scripts and CI steps for downloading, building, and running Zipformer CTC models Model doc is available at https://k2-fsa.github.io/sherpa/onnx/pretrained_models/offline-ctc/icefall/zipformer.html
This commit is contained in:
@@ -29,6 +29,10 @@ data class OfflineDolphinModelConfig(
|
||||
var model: String = "",
|
||||
)
|
||||
|
||||
data class OfflineZipformerCtcModelConfig(
|
||||
var model: String = "",
|
||||
)
|
||||
|
||||
data class OfflineWhisperModelConfig(
|
||||
var encoder: String = "",
|
||||
var decoder: String = "",
|
||||
@@ -64,6 +68,7 @@ data class OfflineModelConfig(
|
||||
var nemo: OfflineNemoEncDecCtcModelConfig = OfflineNemoEncDecCtcModelConfig(),
|
||||
var senseVoice: OfflineSenseVoiceModelConfig = OfflineSenseVoiceModelConfig(),
|
||||
var dolphin: OfflineDolphinModelConfig = OfflineDolphinModelConfig(),
|
||||
var zipformerCtc: OfflineZipformerCtcModelConfig = OfflineZipformerCtcModelConfig(),
|
||||
var teleSpeech: String = "",
|
||||
var numThreads: Int = 1,
|
||||
var debug: Boolean = false,
|
||||
@@ -559,6 +564,16 @@ fun getOfflineModelConfig(type: Int): OfflineModelConfig? {
|
||||
modelType = "nemo_transducer",
|
||||
)
|
||||
}
|
||||
|
||||
31 -> {
|
||||
val modelDir = "sherpa-onnx-zipformer-ctc-zh-int8-2025-07-03"
|
||||
return OfflineModelConfig(
|
||||
zipformerCtc = OfflineZipformerCtcModelConfig(
|
||||
model = "$modelDir/model.int8.onnx",
|
||||
),
|
||||
tokens = "$modelDir/tokens.txt",
|
||||
)
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -412,6 +412,7 @@ fun getModelConfig(type: Int): OnlineModelConfig? {
|
||||
model = "$modelDir/model.onnx",
|
||||
),
|
||||
tokens = "$modelDir/tokens.txt",
|
||||
modelType = "zipformer2",
|
||||
)
|
||||
}
|
||||
|
||||
@@ -422,6 +423,7 @@ fun getModelConfig(type: Int): OnlineModelConfig? {
|
||||
model = "$modelDir/model.fp16.onnx",
|
||||
),
|
||||
tokens = "$modelDir/tokens.txt",
|
||||
modelType = "zipformer2",
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user