yangwang825 commited on
Commit
83360fe
1 Parent(s): 3c65bbc

Create configuration_svector.py

Browse files
Files changed (1) hide show
  1. configuration_svector.py +54 -0
configuration_svector.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers.configuration_utils import PretrainedConfig
2
+
3
+
4
+ class SvectorConfig(PretrainedConfig):
5
+
6
+ model_type = 'svector'
7
+
8
+ def __init__(
9
+ self,
10
+ n_mels=40,
11
+ sample_rate=16000,
12
+ win_length=25,
13
+ hop_length=10,
14
+ mean_norm=True,
15
+ std_norm=False,
16
+ norm_type='sentence',
17
+ num_heads=8,
18
+ num_layers=5,
19
+ hidden_size=512,
20
+ num_classes=1251,
21
+ loss_fn='aam',
22
+ auto_map={
23
+ "AutoConfig": "configuration_svector.SvectorConfig",
24
+ "AutoModel": "modeling_svector.SvectorModel",
25
+ "AutoModelForAudioClassification": "modeling_svector.SvectorModelForSequenceClassification"
26
+ },
27
+ initializer_range=0.02,
28
+ **kwargs
29
+ ):
30
+ # Compute features
31
+ self.n_mels = n_mels
32
+ self.sample_rate = sample_rate
33
+ self.win_length = win_length
34
+ self.hop_length = hop_length
35
+
36
+ # Mean variance norm
37
+ self.mean_norm = mean_norm
38
+ self.std_norm = std_norm
39
+ self.norm_type = norm_type
40
+
41
+ # Embedding model
42
+ self.hidden_size = hidden_size
43
+ self.num_heads = num_heads
44
+ self.num_layers = num_layers
45
+
46
+ # Classifier
47
+ self.num_classes = num_classes
48
+ self.loss_fn = loss_fn
49
+
50
+ # Others
51
+ self.auto_map = auto_map
52
+ self.initializer_range = initializer_range
53
+
54
+ super().__init__(**kwargs)