| from transformers.configuration_utils import PretrainedConfig | |
| class SvectorConfig(PretrainedConfig): | |
| model_type = 'svector' | |
| def __init__( | |
| self, | |
| n_mels=40, | |
| sample_rate=16000, | |
| win_length=25, | |
| hop_length=10, | |
| mean_norm=True, | |
| std_norm=False, | |
| norm_type='sentence', | |
| num_heads=8, | |
| num_layers=5, | |
| hidden_size=512, | |
| num_classes=1251, | |
| loss_fn='aam', | |
| auto_map={ | |
| "AutoConfig": "configuration_svector.SvectorConfig", | |
| "AutoModel": "modeling_svector.SvectorModel", | |
| "AutoModelForAudioClassification": "modeling_svector.SvectorModelForSequenceClassification" | |
| }, | |
| initializer_range=0.02, | |
| **kwargs | |
| ): | |
| # Compute features | |
| self.n_mels = n_mels | |
| self.sample_rate = sample_rate | |
| self.win_length = win_length | |
| self.hop_length = hop_length | |
| # Mean variance norm | |
| self.mean_norm = mean_norm | |
| self.std_norm = std_norm | |
| self.norm_type = norm_type | |
| # Embedding model | |
| self.hidden_size = hidden_size | |
| self.num_heads = num_heads | |
| self.num_layers = num_layers | |
| # Classifier | |
| self.num_classes = num_classes | |
| self.loss_fn = loss_fn | |
| # Others | |
| self.auto_map = auto_map | |
| self.initializer_range = initializer_range | |
| super().__init__(**kwargs) | |