Support .Net framework 2.0 (#1062)

This commit is contained in:
Fangjun Kuang
2024-06-28 11:27:19 +08:00
committed by GitHub
parent 598c12c4e5
commit 8c4f576f1b
10 changed files with 90 additions and 79 deletions

View File

@@ -17,75 +17,74 @@ class OfflineDecodeFiles
{
[Option("sample-rate", Required = false, Default = 16000, HelpText = "Sample rate of the data used to train the model")]
public int SampleRate { get; set; }
public int SampleRate { get; set; } = 16000;
[Option("feat-dim", Required = false, Default = 80, HelpText = "Dimension of the features used to train the model")]
public int FeatureDim { get; set; }
public int FeatureDim { get; set; } = 80;
[Option(Required = false, HelpText = "Path to tokens.txt")]
public string Tokens { get; set; }
public string Tokens { get; set; } = "";
[Option(Required = false, Default = "", HelpText = "Path to transducer encoder.onnx. Used only for transducer models")]
public string Encoder { get; set; }
public string Encoder { get; set; } = "";
[Option(Required = false, Default = "", HelpText = "Path to transducer decoder.onnx. Used only for transducer models")]
public string Decoder { get; set; }
public string Decoder { get; set; } = "";
[Option(Required = false, Default = "",HelpText = "Path to transducer joiner.onnx. Used only for transducer models")]
public string Joiner { get; set; }
public string Joiner { get; set; } = "";
[Option("model-type", Required = false, Default = "", HelpText = "model type")]
public string ModelType { get; set; }
public string ModelType { get; set; } = "";
[Option("whisper-encoder", Required = false, Default = "", HelpText = "Path to whisper encoder.onnx. Used only for whisper models")]
public string WhisperEncoder { get; set; }
public string WhisperEncoder { get; set; } = "";
[Option("whisper-decoder", Required = false, Default = "", HelpText = "Path to whisper decoder.onnx. Used only for whisper models")]
public string WhisperDecoder { get; set; }
public string WhisperDecoder { get; set; } = "";
[Option("whisper-language", Required = false, Default = "", HelpText = "Language of the input file. Can be empty")]
public string WhisperLanguage{ get; set; }
public string WhisperLanguage{ get; set; } = "";
[Option("whisper-task", Required = false, Default = "transcribe", HelpText = "transcribe or translate")]
public string WhisperTask{ get; set; }
public string WhisperTask{ get; set; } = "transcribe";
[Option("tdnn-model", Required = false, Default = "", HelpText = "Path to tdnn yesno model")]
public string TdnnModel { get; set; }
public string TdnnModel { get; set; } = "";
[Option(Required = false, HelpText = "Path to model.onnx. Used only for paraformer models")]
public string Paraformer { get; set; }
public string Paraformer { get; set; } = "";
[Option("nemo-ctc", Required = false, HelpText = "Path to model.onnx. Used only for NeMo CTC models")]
public string NeMoCtc { get; set; }
public string NeMoCtc { get; set; } = "";
[Option("telespeech-ctc", Required = false, HelpText = "Path to model.onnx. Used only for TeleSpeech CTC models")]
public string TeleSpeechCtc { get; set; }
public string TeleSpeechCtc { get; set; } = "";
[Option("num-threads", Required = false, Default = 1, HelpText = "Number of threads for computation")]
public int NumThreads { get; set; }
public int NumThreads { get; set; } = 1;
[Option("decoding-method", Required = false, Default = "greedy_search",
HelpText = "Valid decoding methods are: greedy_search, modified_beam_search")]
public string DecodingMethod { get; set; }
public string DecodingMethod { get; set; } = "greedy_search";
[Option("rule-fsts", Required = false, Default = "",
HelpText = "If not empty, path to rule fst for inverse text normalization")]
public string RuleFsts { get; set; }
public string RuleFsts { get; set; } = "";
[Option("max-active-paths", Required = false, Default = 4,
HelpText = @"Used only when --decoding--method is modified_beam_search.
It specifies number of active paths to keep during the search")]
public int MaxActivePaths { get; set; }
public int MaxActivePaths { get; set; } = 4;
[Option("hotwords-file", Required = false, Default = "", HelpText = "Path to hotwords.txt")]
public string HotwordsFile { get; set; }
public string HotwordsFile { get; set; } = "";
[Option("hotwords-score", Required = false, Default = 1.5F, HelpText = "hotwords score")]
public float HotwordsScore { get; set; }
public float HotwordsScore { get; set; } = 1.5F;
[Option("files", Required = true, HelpText = "Audio files for decoding")]
public IEnumerable<string> Files { get; set; }
public IEnumerable<string> Files { get; set; } = new string[] {};
}
static void Main(string[] args)

View File

@@ -18,49 +18,49 @@ class OfflineTtsDemo
{
[Option("tts-rule-fsts", Required = false, Default = "", HelpText = "path to rule.fst")]
public string RuleFsts { get; set; }
public string RuleFsts { get; set; } = "";
[Option("tts-rule-fars", Required = false, Default = "", HelpText = "path to rule.far")]
public string RuleFars { get; set; }
public string RuleFars { get; set; } = "";
[Option("vits-dict-dir", Required = false, Default = "", HelpText = "Path to the directory containing dict for jieba.")]
public string DictDir { get; set; }
public string DictDir { get; set; } = "";
[Option("vits-data-dir", Required = false, Default = "", HelpText = "Path to the directory containing dict for espeak-ng.")]
public string DataDir { get; set; }
public string DataDir { get; set; } = "";
[Option("vits-length-scale", Required = false, Default = 1, HelpText = "speech speed. Larger->Slower; Smaller->faster")]
public float LengthScale { get; set; }
public float LengthScale { get; set; } = 1;
[Option("vits-noise-scale", Required = false, Default = 0.667f, HelpText = "noise_scale for VITS models")]
public float NoiseScale { get; set; }
public float NoiseScale { get; set; } = 0.667F;
[Option("vits-noise-scale-w", Required = false, Default = 0.8f, HelpText = "noise_scale_w for VITS models")]
public float NoiseScaleW { get; set; }
[Option("vits-noise-scale-w", Required = false, Default = 0.8F, HelpText = "noise_scale_w for VITS models")]
public float NoiseScaleW { get; set; } = 0.8F;
[Option("vits-lexicon", Required = false, Default = "", HelpText = "Path to lexicon.txt")]
public string Lexicon { get; set; }
public string Lexicon { get; set; } = "";
[Option("vits-tokens", Required = false, Default = "", HelpText = "Path to tokens.txt")]
public string Tokens { get; set; }
public string Tokens { get; set; } = "";
[Option("tts-max-num-sentences", Required = false, Default = 1, HelpText = "Maximum number of sentences that we process at a time.")]
public int MaxNumSentences { get; set; }
public int MaxNumSentences { get; set; } = 1;
[Option(Required = false, Default = 0, HelpText = "1 to show debug messages.")]
public int Debug { get; set; }
public int Debug { get; set; } = 0;
[Option("vits-model", Required = true, HelpText = "Path to VITS model")]
public string Model { get; set; }
public string Model { get; set; } = "";
[Option("sid", Required = false, Default = 0, HelpText = "Speaker ID")]
public int SpeakerId { get; set; }
public int SpeakerId { get; set; } = 0;
[Option("text", Required = true, HelpText = "Text to synthesize")]
public string Text { get; set; }
public string Text { get; set; } = "";
[Option("output-filename", Required = true, Default = "./generated.wav", HelpText = "Path to save the generated audio")]
public string OutputFilename { get; set; }
public string OutputFilename { get; set; } = "./generated.wav";
}
static void Main(string[] args)

View File

@@ -18,81 +18,80 @@ class OnlineDecodeFiles
class Options
{
[Option(Required = true, HelpText = "Path to tokens.txt")]
public string Tokens { get; set; }
public string Tokens { get; set; } = "";
[Option(Required = false, Default = "cpu", HelpText = "Provider, e.g., cpu, coreml")]
public string Provider { get; set; }
public string Provider { get; set; } = "";
[Option(Required = false, HelpText = "Path to transducer encoder.onnx")]
public string Encoder { get; set; }
public string Encoder { get; set; } = "";
[Option(Required = false, HelpText = "Path to transducer decoder.onnx")]
public string Decoder { get; set; }
public string Decoder { get; set; } = "";
[Option(Required = false, HelpText = "Path to transducer joiner.onnx")]
public string Joiner { get; set; }
public string Joiner { get; set; } = "";
[Option("paraformer-encoder", Required = false, HelpText = "Path to paraformer encoder.onnx")]
public string ParaformerEncoder { get; set; }
public string ParaformerEncoder { get; set; } = "";
[Option("paraformer-decoder", Required = false, HelpText = "Path to paraformer decoder.onnx")]
public string ParaformerDecoder { get; set; }
public string ParaformerDecoder { get; set; } = "";
[Option("zipformer2-ctc", Required = false, HelpText = "Path to zipformer2 CTC onnx model")]
public string Zipformer2Ctc { get; set; }
public string Zipformer2Ctc { get; set; } = "";
[Option("num-threads", Required = false, Default = 1, HelpText = "Number of threads for computation")]
public int NumThreads { get; set; }
public int NumThreads { get; set; } = 1;
[Option("decoding-method", Required = false, Default = "greedy_search",
HelpText = "Valid decoding methods are: greedy_search, modified_beam_search")]
public string DecodingMethod { get; set; }
public string DecodingMethod { get; set; } = "greedy_search";
[Option(Required = false, Default = false, HelpText = "True to show model info during loading")]
public bool Debug { get; set; }
public bool Debug { get; set; } = false;
[Option("sample-rate", Required = false, Default = 16000, HelpText = "Sample rate of the data used to train the model")]
public int SampleRate { get; set; }
public int SampleRate { get; set; } = 16000;
[Option("max-active-paths", Required = false, Default = 4,
HelpText = @"Used only when --decoding--method is modified_beam_search.
It specifies number of active paths to keep during the search")]
public int MaxActivePaths { get; set; }
public int MaxActivePaths { get; set; } = 4;
[Option("enable-endpoint", Required = false, Default = false,
HelpText = "True to enable endpoint detection.")]
public bool EnableEndpoint { get; set; }
public bool EnableEndpoint { get; set; } = false;
[Option("rule1-min-trailing-silence", Required = false, Default = 2.4F,
HelpText = @"An endpoint is detected if trailing silence in seconds is
larger than this value even if nothing has been decoded. Used only when --enable-endpoint is true.")]
public float Rule1MinTrailingSilence { get; set; }
public float Rule1MinTrailingSilence { get; set; } = 2.4F;
[Option("rule2-min-trailing-silence", Required = false, Default = 1.2F,
HelpText = @"An endpoint is detected if trailing silence in seconds is
larger than this value after something that is not blank has been decoded. Used
only when --enable-endpoint is true.")]
public float Rule2MinTrailingSilence { get; set; }
public float Rule2MinTrailingSilence { get; set; } = 1.2F;
[Option("rule3-min-utterance-length", Required = false, Default = 20.0F,
HelpText = @"An endpoint is detected if the utterance in seconds is
larger than this value. Used only when --enable-endpoint is true.")]
public float Rule3MinUtteranceLength { get; set; }
public float Rule3MinUtteranceLength { get; set; } = 20.0F;
[Option("hotwords-file", Required = false, Default = "", HelpText = "Path to hotwords.txt")]
public string HotwordsFile { get; set; }
public string HotwordsFile { get; set; } = "";
[Option("hotwords-score", Required = false, Default = 1.5F, HelpText = "hotwords score")]
public float HotwordsScore { get; set; }
public float HotwordsScore { get; set; } = 1.5F;
[Option("rule-fsts", Required = false, Default = "",
HelpText = "If not empty, path to rule fst for inverse text normalization")]
public string RuleFsts { get; set; }
public string RuleFsts { get; set; } = "";
[Option("files", Required = true, HelpText = "Audio files for decoding")]
public IEnumerable<string> Files { get; set; }
public IEnumerable<string> Files { get; set; } = new string[] {};
}
static void Main(string[] args)