1""" 2/* Copyright (c) 2023 Amazon 3 Written by Jan Buethe */ 4/* 5 Redistribution and use in source and binary forms, with or without 6 modification, are permitted provided that the following conditions 7 are met: 8 9 - Redistributions of source code must retain the above copyright 10 notice, this list of conditions and the following disclaimer. 11 12 - Redistributions in binary form must reproduce the above copyright 13 notice, this list of conditions and the following disclaimer in the 14 documentation and/or other materials provided with the distribution. 15 16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 20 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27*/ 28""" 29 30 31setup_dict = dict() 32 33lace_setup = { 34 'dataset': '/local/datasets/silk_enhancement_v2_full_6to64kbps/training', 35 'validation_dataset': '/local/datasets/silk_enhancement_v2_full_6to64kbps/validation', 36 'model': { 37 'name': 'lace', 38 'args': [], 39 'kwargs': { 40 'comb_gain_limit_db': 10, 41 'cond_dim': 128, 42 'conv_gain_limits_db': [-12, 12], 43 'global_gain_limits_db': [-6, 6], 44 'hidden_feature_dim': 96, 45 'kernel_size': 15, 46 'num_features': 93, 47 'numbits_embedding_dim': 8, 48 'numbits_range': [50, 650], 49 'partial_lookahead': True, 50 'pitch_embedding_dim': 64, 51 'pitch_max': 300, 52 'preemph': 0.85, 53 'skip': 91, 54 'softquant': True, 55 'sparsify': False, 56 'sparsification_density': 0.4, 57 'sparsification_schedule': [10000, 40000, 200] 58 } 59 }, 60 'data': { 61 'frames_per_sample': 100, 62 'no_pitch_value': 7, 63 'preemph': 0.85, 64 'skip': 91, 65 'pitch_hangover': 8, 66 'acorr_radius': 2, 67 'num_bands_clean_spec': 64, 68 'num_bands_noisy_spec': 18, 69 'noisy_spec_scale': 'opus', 70 'pitch_hangover': 0, 71 }, 72 'training': { 73 'batch_size': 256, 74 'lr': 5.e-4, 75 'lr_decay_factor': 2.5e-5, 76 'epochs': 50, 77 'loss': { 78 'w_l1': 0, 79 'w_lm': 0, 80 'w_logmel': 0, 81 'w_sc': 0, 82 'w_wsc': 0, 83 'w_xcorr': 0, 84 'w_sxcorr': 1, 85 'w_l2': 10, 86 'w_slm': 2 87 } 88 } 89} 90 91 92nolace_setup = { 93 'dataset': '/local/datasets/silk_enhancement_v2_full_6to64kbps/training', 94 'validation_dataset': '/local/datasets/silk_enhancement_v2_full_6to64kbps/validation', 95 'model': { 96 'name': 'nolace', 97 'args': [], 98 'kwargs': { 99 'avg_pool_k': 4, 100 'comb_gain_limit_db': 10, 101 'cond_dim': 256, 102 'conv_gain_limits_db': [-12, 12], 103 'global_gain_limits_db': [-6, 6], 104 'hidden_feature_dim': 96, 105 'kernel_size': 15, 106 'num_features': 93, 107 'numbits_embedding_dim': 8, 108 'numbits_range': [50, 650], 109 'partial_lookahead': True, 110 'pitch_embedding_dim': 64, 111 'pitch_max': 300, 112 'preemph': 0.85, 113 'skip': 91, 114 'softquant': True, 115 'sparsify': False, 116 'sparsification_density': 0.4, 117 'sparsification_schedule': [10000, 40000, 200] 118 } 119 }, 120 'data': { 121 'frames_per_sample': 100, 122 'no_pitch_value': 7, 123 'preemph': 0.85, 124 'skip': 91, 125 'pitch_hangover': 8, 126 'acorr_radius': 2, 127 'num_bands_clean_spec': 64, 128 'num_bands_noisy_spec': 18, 129 'noisy_spec_scale': 'opus', 130 'pitch_hangover': 0, 131 }, 132 'training': { 133 'batch_size': 256, 134 'lr': 5.e-4, 135 'lr_decay_factor': 2.5e-5, 136 'epochs': 50, 137 'loss': { 138 'w_l1': 0, 139 'w_lm': 0, 140 'w_logmel': 0, 141 'w_sc': 0, 142 'w_wsc': 0, 143 'w_xcorr': 0, 144 'w_sxcorr': 1, 145 'w_l2': 10, 146 'w_slm': 2 147 } 148 } 149} 150 151nolace_setup_adv = { 152 'dataset': '/local/datasets/silk_enhancement_v2_full_6to64kbps/training', 153 'model': { 154 'name': 'nolace', 155 'args': [], 156 'kwargs': { 157 'avg_pool_k': 4, 158 'comb_gain_limit_db': 10, 159 'cond_dim': 256, 160 'conv_gain_limits_db': [-12, 12], 161 'global_gain_limits_db': [-6, 6], 162 'hidden_feature_dim': 96, 163 'kernel_size': 15, 164 'num_features': 93, 165 'numbits_embedding_dim': 8, 166 'numbits_range': [50, 650], 167 'partial_lookahead': True, 168 'pitch_embedding_dim': 64, 169 'pitch_max': 300, 170 'preemph': 0.85, 171 'skip': 91, 172 'softquant': True, 173 'sparsify': False, 174 'sparsification_density': 0.4, 175 'sparsification_schedule': [0, 0, 200] 176 } 177 }, 178 'data': { 179 'frames_per_sample': 100, 180 'no_pitch_value': 7, 181 'preemph': 0.85, 182 'skip': 91, 183 'pitch_hangover': 8, 184 'acorr_radius': 2, 185 'num_bands_clean_spec': 64, 186 'num_bands_noisy_spec': 18, 187 'noisy_spec_scale': 'opus', 188 'pitch_hangover': 0, 189 }, 190 'discriminator': { 191 'args': [], 192 'kwargs': { 193 'architecture': 'free', 194 'design': 'f_down', 195 'fft_sizes_16k': [ 196 64, 197 128, 198 256, 199 512, 200 1024, 201 2048, 202 ], 203 'freq_roi': [0, 7400], 204 'fs': 16000, 205 'max_channels': 256, 206 'noise_gain': 0.0, 207 }, 208 'name': 'fdmresdisc', 209 }, 210 'training': { 211 'adv_target': 'target_orig', 212 'batch_size': 64, 213 'epochs': 50, 214 'gen_lr_reduction': 1, 215 'lambda_feat': 1.0, 216 'lambda_reg': 0.6, 217 'loss': { 218 'w_l1': 0, 219 'w_l2': 10, 220 'w_lm': 0, 221 'w_logmel': 0, 222 'w_sc': 0, 223 'w_slm': 20, 224 'w_sxcorr': 1, 225 'w_wsc': 0, 226 'w_xcorr': 0, 227 }, 228 'lr': 0.0001, 229 'lr_decay_factor': 2.5e-09, 230 } 231} 232 233 234lavoce_setup = { 235 'data': { 236 'frames_per_sample': 100, 237 'target': 'signal' 238 }, 239 'dataset': '/local/datasets/lpcnet_large/training', 240 'model': { 241 'args': [], 242 'kwargs': { 243 'comb_gain_limit_db': 10, 244 'cond_dim': 256, 245 'conv_gain_limits_db': [-12, 12], 246 'global_gain_limits_db': [-6, 6], 247 'kernel_size': 15, 248 'num_features': 19, 249 'pitch_embedding_dim': 64, 250 'pitch_max': 300, 251 'preemph': 0.85, 252 'pulses': True 253 }, 254 'name': 'lavoce' 255 }, 256 'training': { 257 'batch_size': 256, 258 'epochs': 50, 259 'loss': { 260 'w_l1': 0, 261 'w_l2': 0, 262 'w_lm': 0, 263 'w_logmel': 0, 264 'w_sc': 0, 265 'w_slm': 2, 266 'w_sxcorr': 1, 267 'w_wsc': 0, 268 'w_xcorr': 0 269 }, 270 'lr': 0.0005, 271 'lr_decay_factor': 2.5e-05 272 }, 273 'validation_dataset': '/local/datasets/lpcnet_large/validation' 274} 275 276lavoce_setup_adv = { 277 'data': { 278 'frames_per_sample': 100, 279 'target': 'signal' 280 }, 281 'dataset': '/local/datasets/lpcnet_large/training', 282 'discriminator': { 283 'args': [], 284 'kwargs': { 285 'architecture': 'free', 286 'design': 'f_down', 287 'fft_sizes_16k': [ 288 64, 289 128, 290 256, 291 512, 292 1024, 293 2048, 294 ], 295 'freq_roi': [0, 7400], 296 'fs': 16000, 297 'max_channels': 256, 298 'noise_gain': 0.0, 299 }, 300 'name': 'fdmresdisc', 301 }, 302 'model': { 303 'args': [], 304 'kwargs': { 305 'comb_gain_limit_db': 10, 306 'cond_dim': 256, 307 'conv_gain_limits_db': [-12, 12], 308 'global_gain_limits_db': [-6, 6], 309 'kernel_size': 15, 310 'num_features': 19, 311 'pitch_embedding_dim': 64, 312 'pitch_max': 300, 313 'preemph': 0.85, 314 'pulses': True 315 }, 316 'name': 'lavoce' 317 }, 318 'training': { 319 'batch_size': 64, 320 'epochs': 50, 321 'gen_lr_reduction': 1, 322 'lambda_feat': 1.0, 323 'lambda_reg': 0.6, 324 'loss': { 325 'w_l1': 0, 326 'w_l2': 0, 327 'w_lm': 0, 328 'w_logmel': 0, 329 'w_sc': 0, 330 'w_slm': 2, 331 'w_sxcorr': 1, 332 'w_wsc': 0, 333 'w_xcorr': 0 334 }, 335 'lr': 0.0001, 336 'lr_decay_factor': 2.5e-09 337 }, 338} 339 340 341setup_dict = { 342 'lace': lace_setup, 343 'nolace': nolace_setup, 344 'nolace_adv': nolace_setup_adv, 345 'lavoce': lavoce_setup, 346 'lavoce_adv': lavoce_setup_adv 347} 348