pub struct Config { /* private fields */ }Expand description
Configuration for a Model. See Model::from_pretrained for a simple way to get started.
Implementations§
Source§impl Config
impl Config
Sourcepub fn transducer(
encoder: &str,
decoder: &str,
joiner: &str,
tokens: &str,
) -> Self
pub fn transducer( encoder: &str, decoder: &str, joiner: &str, tokens: &str, ) -> Self
Make a new Config for a transducer model with reasonable defaults.
Sourcepub fn paraformer(encoder: &str, decoder: &str, tokens: &str) -> Self
pub fn paraformer(encoder: &str, decoder: &str, tokens: &str) -> Self
Make a new Config for a paraformer model with reasonable defaults.
Sourcepub fn zipformer2_ctc(model: &str, tokens: &str) -> Self
pub fn zipformer2_ctc(model: &str, tokens: &str) -> Self
Make a new Config for a zipformer2 ctc model with reasonable defaults.
Sourcepub fn sample_rate(self, rate: usize) -> Self
pub fn sample_rate(self, rate: usize) -> Self
Set the model’s sample rate - usually 16000 for most transducers.
Sourcepub fn feature_dim(self, dim: usize) -> Self
pub fn feature_dim(self, dim: usize) -> Self
Set the model’s feature dimension - usually 80 for most transducers.
Sourcepub fn num_threads(self, n: usize) -> Self
pub fn num_threads(self, n: usize) -> Self
Set the number of threads to use. Defaults to physical core count or 8, whichever is smaller.
Sourcepub fn cuda(self) -> Self
Available on crate feature cuda only.
pub fn cuda(self) -> Self
cuda only.Use CUDA as the compute provider. This requires CUDA 11.8.
Sourcepub fn directml(self) -> Self
Available on crate feature directml only.
pub fn directml(self) -> Self
directml only.Use DirectML as the compute provider.
Sourcepub fn greedy_search(self) -> Self
pub fn greedy_search(self) -> Self
Take the symbol with largest posterior probability of each frame as the decoding result.
Sourcepub fn modified_beam_search(self) -> Self
pub fn modified_beam_search(self) -> Self
Keep topk states for each frame, then expand kept states with their own contexts to next frame.
Sourcepub fn max_active_paths(self, n: usize) -> Self
pub fn max_active_paths(self, n: usize) -> Self
Maximum number of active paths to keep when Config::modified_beam_search is used.
Defaults to 16.
Sourcepub fn detect_endpoints(self, enable: bool) -> Self
pub fn detect_endpoints(self, enable: bool) -> Self
Enable endpoint detection. Defaults to disabled.
Sourcepub fn rule1_min_trailing_silence(self, seconds: f32) -> Self
pub fn rule1_min_trailing_silence(self, seconds: f32) -> Self
Detect endpoint if trailing silence is larger than this value even if nothing has been decoded.
Sourcepub fn rule2_min_trailing_silence(self, seconds: f32) -> Self
pub fn rule2_min_trailing_silence(self, seconds: f32) -> Self
Detect endpoint if trailing silence is larger than this value and a non-blank has been decoded.
Sourcepub fn rule3_min_utterance_length(self, seconds: f32) -> Self
pub fn rule3_min_utterance_length(self, seconds: f32) -> Self
Detect an endpoint if an utterance is larger than this value.