Fix various language binding APIs for tdnn and whisper models (#278)

This commit is contained in:
Fangjun Kuang
2023-08-16 22:15:10 +08:00
committed by GitHub
parent 3ab135c1eb
commit e31f9e48c2
16 changed files with 249 additions and 14 deletions

View File

@@ -309,6 +309,15 @@ type OfflineNemoEncDecCtcModelConfig struct {
Model string // Path to the model, e.g., model.onnx or model.int8.onnx
}
type OfflineWhisperModelConfig struct {
Encoder string
Decoder string
}
type OfflineTdnnModelConfig struct {
Model string
}
// Configuration for offline LM.
type OfflineLMConfig struct {
Model string // Path to the model
@@ -319,6 +328,8 @@ type OfflineModelConfig struct {
Transducer OfflineTransducerModelConfig
Paraformer OfflineParaformerModelConfig
NemoCTC OfflineNemoEncDecCtcModelConfig
Whisper OfflineWhisperModelConfig
Tdnn OfflineTdnnModelConfig
Tokens string // Path to tokens.txt
// Number of threads to use for neural network computation
@@ -390,6 +401,15 @@ func NewOfflineRecognizer(config *OfflineRecognizerConfig) *OfflineRecognizer {
c.model_config.nemo_ctc.model = C.CString(config.ModelConfig.NemoCTC.Model)
defer C.free(unsafe.Pointer(c.model_config.nemo_ctc.model))
c.model_config.whisper.encoder = C.CString(config.ModelConfig.Whisper.Encoder)
defer C.free(unsafe.Pointer(c.model_config.whisper.encoder))
c.model_config.whisper.decoder = C.CString(config.ModelConfig.Whisper.Decoder)
defer C.free(unsafe.Pointer(c.model_config.whisper.decoder))
c.model_config.tdnn.decoder = C.CString(config.ModelConfig.Tdnn.Model)
defer C.free(unsafe.Pointer(c.model_config.tdnn.model))
c.model_config.tokens = C.CString(config.ModelConfig.Tokens)
defer C.free(unsafe.Pointer(c.model_config.tokens))