Skip to main content

parakeet_rs/
config.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize)]
4pub struct PreprocessorConfig {
5    pub feature_extractor_type: String,
6    pub feature_size: usize,
7    pub hop_length: usize,
8    pub n_fft: usize,
9    pub padding_side: String,
10    pub padding_value: f32,
11    pub preemphasis: f32,
12    pub processor_class: String,
13    pub return_attention_mask: bool,
14    pub sampling_rate: usize,
15    pub win_length: usize,
16}
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
19pub struct ModelConfig {
20    pub architectures: Vec<String>,
21    pub vocab_size: usize,
22    pub pad_token_id: usize,
23}
24
25impl Default for PreprocessorConfig {
26    fn default() -> Self {
27        Self {
28            feature_extractor_type: "ParakeetFeatureExtractor".to_string(),
29            feature_size: 80,
30            hop_length: 160,
31            n_fft: 512,
32            padding_side: "right".to_string(),
33            padding_value: 0.0,
34            preemphasis: 0.97,
35            processor_class: "ParakeetProcessor".to_string(),
36            return_attention_mask: true,
37            sampling_rate: 16000,
38            win_length: 400,
39        }
40    }
41}
42
43impl Default for ModelConfig {
44    fn default() -> Self {
45        Self {
46            architectures: vec!["ParakeetForCTC".to_string()],
47            vocab_size: 1025,
48            pad_token_id: 1024,
49        }
50    }
51}