yangwang825 commited on
Commit
8f2be8b
1 Parent(s): d6f6421

Create configuration_ecapa.py

Browse files
Files changed (1) hide show
  1. configuration_ecapa.py +65 -0
configuration_ecapa.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers.configuration_utils import PretrainedConfig
2
+
3
+
4
+ class EcapaConfig(PretrainedConfig):
5
+
6
+ model_type = 'ecapa'
7
+
8
+ def __init__(
9
+ self,
10
+ n_mels=80,
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
+ hidden_size=192,
18
+ channels=[512, 512, 512, 512, 1536],
19
+ kernel_sizes=[5, 3, 3, 3, 1],
20
+ dilations=[1, 2, 3, 4, 1],
21
+ attention_channels=128,
22
+ res2net_scale=8,
23
+ se_channels=128,
24
+ global_context=True,
25
+ groups=[1, 1, 1, 1, 1],
26
+ num_classes=1251,
27
+ loss_fn='aam',
28
+ auto_map={
29
+ "AutoConfig": "configuration_ecapa.EcapaConfig",
30
+ "AutoModel": "modeling_ecapa.EcapaModel",
31
+ },
32
+ initializer_range=0.02,
33
+ **kwargs
34
+ ):
35
+ # Compute features
36
+ self.n_mels = n_mels
37
+ self.sample_rate = sample_rate
38
+ self.win_length = win_length
39
+ self.hop_length = hop_length
40
+
41
+ # Mean variance norm
42
+ self.mean_norm = mean_norm
43
+ self.std_norm = std_norm
44
+ self.norm_type = norm_type
45
+
46
+ # Embedding model
47
+ self.channels = channels
48
+ self.kernel_sizes = kernel_sizes
49
+ self.attention_channels = attention_channels
50
+ self.dilations = dilations
51
+ self.res2net_scale = res2net_scale
52
+ self.se_channels = se_channels
53
+ self.global_context = global_context
54
+ self.groups = groups
55
+ self.hidden_size = hidden_size
56
+
57
+ # Classifier
58
+ self.num_classes = num_classes
59
+ self.loss_fn = loss_fn
60
+
61
+ # Others
62
+ self.auto_map = auto_map
63
+ self.initializer_range = initializer_range
64
+
65
+ super().__init__(**kwargs)