Fix CI (#964)
This commit is contained in:
@@ -23,6 +23,8 @@ namespace SherpaOnnx
|
||||
Debug = 0;
|
||||
Provider = "cpu";
|
||||
ModelType = "";
|
||||
ModelingUnit = "cjkchar";
|
||||
BpeVocab = "";
|
||||
}
|
||||
public OfflineTransducerModelConfig Transducer;
|
||||
public OfflineParaformerModelConfig Paraformer;
|
||||
@@ -42,5 +44,11 @@ namespace SherpaOnnx
|
||||
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string ModelType;
|
||||
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string ModelingUnit;
|
||||
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string BpeVocab;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace SherpaOnnx
|
||||
Provider = "cpu";
|
||||
Debug = 0;
|
||||
ModelType = "";
|
||||
ModelingUnit = "cjkchar";
|
||||
BpeVocab = "";
|
||||
}
|
||||
|
||||
public OnlineTransducerModelConfig Transducer;
|
||||
@@ -43,5 +45,11 @@ namespace SherpaOnnx
|
||||
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string ModelType;
|
||||
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string ModelingUnit;
|
||||
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string BpeVocab;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,8 @@ type OnlineModelConfig struct {
|
||||
Provider string // Optional. Valid values are: cpu, cuda, coreml
|
||||
Debug int // 1 to show model meta information while loading it.
|
||||
ModelType string // Optional. You can specify it for faster model initialization
|
||||
ModelingUnit string // Optional. cjkchar, bpe, cjkchar+bpe
|
||||
BpeVocab string // Optional.
|
||||
}
|
||||
|
||||
// Configuration for the feature extractor
|
||||
@@ -187,6 +189,12 @@ func NewOnlineRecognizer(config *OnlineRecognizerConfig) *OnlineRecognizer {
|
||||
c.model_config.model_type = C.CString(config.ModelConfig.ModelType)
|
||||
defer C.free(unsafe.Pointer(c.model_config.model_type))
|
||||
|
||||
c.model_config.modeling_unit = C.CString(config.ModelConfig.ModelingUnit)
|
||||
defer C.free(unsafe.Pointer(c.model_config.modeling_unit))
|
||||
|
||||
c.model_config.bpe_vocab = C.CString(config.ModelConfig.BpeVocab)
|
||||
defer C.free(unsafe.Pointer(c.model_config.bpe_vocab))
|
||||
|
||||
c.decoding_method = C.CString(config.DecodingMethod)
|
||||
defer C.free(unsafe.Pointer(c.decoding_method))
|
||||
|
||||
@@ -372,6 +380,9 @@ type OfflineModelConfig struct {
|
||||
|
||||
// Optional. Specify it for faster model initialization.
|
||||
ModelType string
|
||||
|
||||
ModelingUnit string // Optional. cjkchar, bpe, cjkchar+bpe
|
||||
BpeVocab string // Optional.
|
||||
}
|
||||
|
||||
// Configuration for the offline/non-streaming recognizer.
|
||||
@@ -460,6 +471,12 @@ func NewOfflineRecognizer(config *OfflineRecognizerConfig) *OfflineRecognizer {
|
||||
c.model_config.model_type = C.CString(config.ModelConfig.ModelType)
|
||||
defer C.free(unsafe.Pointer(c.model_config.model_type))
|
||||
|
||||
c.model_config.modeling_unit = C.CString(config.ModelConfig.ModelingUnit)
|
||||
defer C.free(unsafe.Pointer(c.model_config.modeling_unit))
|
||||
|
||||
c.model_config.bpe_vocab = C.CString(config.ModelConfig.BpeVocab)
|
||||
defer C.free(unsafe.Pointer(c.model_config.bpe_vocab))
|
||||
|
||||
c.lm_config.model = C.CString(config.LmConfig.Model)
|
||||
defer C.free(unsafe.Pointer(c.lm_config.model))
|
||||
|
||||
|
||||
@@ -126,6 +126,8 @@ static SherpaOnnxOfflineModelConfig GetOfflineModelConfig(Napi::Object obj) {
|
||||
|
||||
SHERPA_ONNX_ASSIGN_ATTR_STR(provider, provider);
|
||||
SHERPA_ONNX_ASSIGN_ATTR_STR(model_type, modelType);
|
||||
SHERPA_ONNX_ASSIGN_ATTR_STR(modeling_unit, modelingUnit);
|
||||
SHERPA_ONNX_ASSIGN_ATTR_STR(bpe_vocab, bpeVocab);
|
||||
|
||||
return c;
|
||||
}
|
||||
@@ -232,6 +234,14 @@ CreateOfflineRecognizerWrapper(const Napi::CallbackInfo &info) {
|
||||
delete[] c.model_config.model_type;
|
||||
}
|
||||
|
||||
if (c.model_config.modeling_unit) {
|
||||
delete[] c.model_config.modeling_unit;
|
||||
}
|
||||
|
||||
if (c.model_config.bpe_vocab) {
|
||||
delete[] c.model_config.bpe_vocab;
|
||||
}
|
||||
|
||||
if (c.lm_config.model) {
|
||||
delete[] c.lm_config.model;
|
||||
}
|
||||
|
||||
@@ -118,6 +118,8 @@ SherpaOnnxOnlineModelConfig GetOnlineModelConfig(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);
|
||||
|
||||
return c;
|
||||
}
|
||||
@@ -228,6 +230,14 @@ static Napi::External<SherpaOnnxOnlineRecognizer> CreateOnlineRecognizerWrapper(
|
||||
delete[] c.model_config.model_type;
|
||||
}
|
||||
|
||||
if (c.model_config.modeling_unit) {
|
||||
delete[] c.model_config.modeling_unit;
|
||||
}
|
||||
|
||||
if (c.model_config.bpe_vocab) {
|
||||
delete[] c.model_config.bpe_vocab;
|
||||
}
|
||||
|
||||
if (c.decoding_method) {
|
||||
delete[] c.decoding_method;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user