wsntxxn commited on
Commit
ef9c1d9
1 Parent(s): 52e4635

Upload Cnn8RnnSoundEventDetection

Browse files
Files changed (2) hide show
  1. config.json +1 -0
  2. hf_model.py +3 -1
config.json CHANGED
@@ -7,6 +7,7 @@
7
  "AutoModel": "hf_model.Cnn8RnnSoundEventDetection"
8
  },
9
  "classes_num": 447,
 
10
  "torch_dtype": "float32",
11
  "transformers_version": "4.30.2"
12
  }
 
7
  "AutoModel": "hf_model.Cnn8RnnSoundEventDetection"
8
  },
9
  "classes_num": 447,
10
+ "sample_rate": 32000,
11
  "torch_dtype": "float32",
12
  "transformers_version": "4.30.2"
13
  }
hf_model.py CHANGED
@@ -118,9 +118,11 @@ class Cnn8RnnConfig(PretrainedConfig):
118
  def __init__(
119
  self,
120
  classes_num: int = 447,
 
121
  **kwargs
122
  ):
123
  self.classes_num = classes_num
 
124
  super().__init__(**kwargs)
125
 
126
 
@@ -136,7 +138,7 @@ class Cnn8RnnSoundEventDetection(PreTrainedModel):
136
 
137
  # Logmel spectrogram extractor
138
  self.melspec_extractor = transforms.MelSpectrogram(
139
- sample_rate=32000,
140
  n_fft=1024,
141
  win_length=1024,
142
  hop_length=320,
 
118
  def __init__(
119
  self,
120
  classes_num: int = 447,
121
+ sample_rate: int = 32000,
122
  **kwargs
123
  ):
124
  self.classes_num = classes_num
125
+ self.sample_rate = sample_rate
126
  super().__init__(**kwargs)
127
 
128
 
 
138
 
139
  # Logmel spectrogram extractor
140
  self.melspec_extractor = transforms.MelSpectrogram(
141
+ sample_rate=config.sample_rate,
142
  n_fft=1024,
143
  win_length=1024,
144
  hop_length=320,