hahmadraz commited on
Commit
0ed8cc3
1 Parent(s): 6178ce6

Upload 12 files

Browse files
Files changed (12) hide show
  1. CKPT.yaml +4 -0
  2. README.md +133 -0
  3. brain.ckpt +3 -0
  4. config.json +3 -0
  5. counter.ckpt +3 -0
  6. dataloader-TRAIN.ckpt +3 -0
  7. decoder.ckpt +3 -0
  8. encoder.ckpt +3 -0
  9. hyperparams.yaml +175 -0
  10. masknet.ckpt +3 -0
  11. optimizer.ckpt +3 -0
  12. scaler.ckpt +3 -0
CKPT.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # yamllint disable
2
+ end-of-epoch: true
3
+ si-snr: -5.768610138794406
4
+ unixtime: 1708444525.2560909
README.md ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: "en"
3
+ thumbnail:
4
+ tags:
5
+ - Source Separation
6
+ - Speech Separation
7
+ - Audio Source Separation
8
+ - Libri3Mix
9
+ - SepFormer
10
+ - Transformer
11
+ - audio-to-audio
12
+ - audio-source-separation
13
+ - speechbrain
14
+ license: "apache-2.0"
15
+ datasets:
16
+ - Libri3Mix
17
+ metrics:
18
+ - SI-SNRi
19
+ - SDRi
20
+
21
+ ---
22
+
23
+ <iframe src="https://ghbtns.com/github-btn.html?user=speechbrain&repo=speechbrain&type=star&count=true&size=large&v=2" frameborder="0" scrolling="0" width="170" height="30" title="GitHub"></iframe>
24
+ <br/><br/>
25
+
26
+ # SepFormer trained on Libri3Mix
27
+
28
+ This repository provides all the necessary tools to perform audio source separation with a [SepFormer](https://arxiv.org/abs/2010.13154v2)
29
+ model, implemented with SpeechBrain, and pretrained on Libri3Mix dataset. For a better experience we encourage you to learn more about
30
+ [SpeechBrain](https://speechbrain.github.io). The model performance is 19.8 dB SI-SNRi on the test set of Libri3Mix dataset.
31
+
32
+ | Release | Train-Set SI-SNRi | Test-Set SI-SNRi |
33
+ |:-------------:|:--------------:|:--------------:|
34
+ | 16-09-22 | 9.51.0dB | 5.77.4dB |
35
+
36
+
37
+ ## Install SpeechBrain
38
+
39
+ First of all, please install SpeechBrain with the following command:
40
+
41
+ ```
42
+ pip install speechbrain
43
+ ```
44
+
45
+ Please notice that we encourage you to read our tutorials and learn more about
46
+ [SpeechBrain](https://speechbrain.github.io).
47
+
48
+ ### Perform source separation on your own audio file
49
+
50
+ ```python
51
+ from speechbrain.pretrained import SepformerSeparation as separator
52
+ import torchaudio
53
+
54
+ model = separator.from_hparams(source="speechbrain/sepformer-libri3mix", savedir='pretrained_models/sepformer-libri3mix')
55
+
56
+ est_sources = model.separate_file(path='speechbrain/sepformer-wsj03mix/test_mixture_3spks.wav')
57
+
58
+ torchaudio.save("source1hat.wav", est_sources[:, :, 0].detach().cpu(), 8000)
59
+ torchaudio.save("source2hat.wav", est_sources[:, :, 1].detach().cpu(), 8000)
60
+ torchaudio.save("source3hat.wav", est_sources[:, :, 2].detach().cpu(), 8000)
61
+
62
+ ```
63
+
64
+ The system expects input recordings sampled at 8kHz (single channel).
65
+ If your signal has a different sample rate, resample it (e.g, using torchaudio or sox) before using the interface.
66
+
67
+ ### Inference on GPU
68
+ To perform inference on the GPU, add `run_opts={"device":"cuda"}` when calling the `from_hparams` method.
69
+
70
+ ### Training
71
+ The model was trained with SpeechBrain (fc2eabb7).
72
+ To train it from scratch follows these steps:
73
+ 1. Clone SpeechBrain:
74
+ ```bash
75
+ git clone https://github.com/speechbrain/speechbrain/
76
+ ```
77
+ 2. Install it:
78
+ ```
79
+ cd speechbrain
80
+ pip install -r requirements.txt
81
+ pip install -e .
82
+ ```
83
+
84
+ 3. Run Training:
85
+ ```
86
+ cd recipes/LibriMix/separation
87
+ python train.py hparams/sepformer.yaml --data_folder=your_data_folder
88
+ ```
89
+ Note: change num_spks to 3 in the yaml file.
90
+
91
+
92
+ You can find our training results (models, logs, etc) [here](https://drive.google.com/drive/folders/1DN49LtAs6cq1X0jZ8tRMlh2Pj6AecClz).
93
+
94
+ ### Limitations
95
+ The SpeechBrain team does not provide any warranty on the performance achieved by this model when used on other datasets.
96
+
97
+ #### Referencing SpeechBrain
98
+
99
+ ```bibtex
100
+ @misc{speechbrain,
101
+ title={{SpeechBrain}: A General-Purpose Speech Toolkit},
102
+ author={Mirco Ravanelli and Titouan Parcollet and Peter Plantinga and Aku Rouhe and Samuele Cornell and Loren Lugosch and Cem Subakan and Nauman Dawalatabad and Abdelwahab Heba and Jianyuan Zhong and Ju-Chieh Chou and Sung-Lin Yeh and Szu-Wei Fu and Chien-Feng Liao and Elena Rastorgueva and François Grondin and William Aris and Hwidong Na and Yan Gao and Renato De Mori and Yoshua Bengio},
103
+ year={2021},
104
+ eprint={2106.04624},
105
+ archivePrefix={arXiv},
106
+ primaryClass={eess.AS},
107
+ note={arXiv:2106.04624}
108
+ }
109
+ ```
110
+
111
+
112
+ #### Referencing SepFormer
113
+ ```bibtex
114
+ @inproceedings{subakan2021attention,
115
+ title={Attention is All You Need in Speech Separation},
116
+ author={Cem Subakan and Mirco Ravanelli and Samuele Cornell and Mirko Bronzi and Jianyuan Zhong},
117
+ year={2021},
118
+ booktitle={ICASSP 2021}
119
+ }
120
+
121
+ @misc{subakan2022sepformer
122
+ author = {Subakan, Cem and Ravanelli, Mirco and Cornell, Samuele and Grondin, Francois and Bronzi, Mirko},
123
+ title = {On Using Transformers for Speech-Separation},
124
+ year = {2022},
125
+ copyright = {arXiv.org perpetual, non-exclusive license}
126
+ }
127
+
128
+ ```
129
+
130
+ # **About SpeechBrain**
131
+ - Website: https://speechbrain.github.io/
132
+ - Code: https://github.com/speechbrain/speechbrain/
133
+ - HuggingFace: https://huggingface.co/speechbrain/
brain.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:33809a026a2c1febce7b03c8aafaee4ddfc851b2c70f180f8c06bf1017f4df5c
3
+ size 46
config.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "speechbrain_interface": "SepformerSeparation"
3
+ }
counter.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7688b6ef52555962d008fff894223582c484517cea7da49ee67800adc7fc8866
3
+ size 2
dataloader-TRAIN.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dc930d7c1a7c02a920e46b457a2d5b77a54d29739719b5da85a12a7eac2607c5
3
+ size 5
decoder.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7a8adecf5da46ffdf91d627cc9c3126057d32424abefb86886a0413224ff5abd
3
+ size 17195
encoder.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5f90be7401e7180f0d5b70583527afb50c837e1038675ce5bddf1368cb8cb7c0
3
+ size 17259
hyperparams.yaml ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generated 2024-02-06 from:
2
+ # /mnt3/speechbrain/recipes/LibriMix/separation/hparams/sepformer-libri3mix.yaml
3
+ # yamllint disable
4
+ # ################################
5
+ # Model: SepFormer for source separation
6
+ # https://arxiv.org/abs/2010.13154
7
+ # Dataset : Libri3Mix
8
+ # ################################
9
+ #
10
+ # Basic parameters
11
+ # Seed needs to be set at top of yaml, before objects with parameters are made
12
+ #
13
+ seed: 1234
14
+ __set_seed: !apply:torch.manual_seed [1234]
15
+
16
+ # Data params
17
+
18
+ # e.g. '/yourpath/Libri3Mix/train-clean-360/'
19
+ # the data folder is needed even if dynamic mixing is applied
20
+ data_folder: /mnt3/Libri3Mix_48k_own/Libri3Mix/
21
+
22
+ # This is needed only if dynamic mixing is applied
23
+ base_folder_dm: /yourpath/LibriSpeech/train-clean-360/
24
+
25
+ experiment_name: sepformer-libri3mix-48k
26
+ output_folder: results/sepformer-libri3mix-48k/1234
27
+ train_log: results/sepformer-libri3mix-48k/1234/train_log.txt
28
+ save_folder: results/sepformer-libri3mix-48k/1234/save
29
+ train_data: results/sepformer-libri3mix-48k/1234/save/libri3mix_train-360.csv
30
+ valid_data: results/sepformer-libri3mix-48k/1234/save/libri3mix_test.csv
31
+ test_data: results/sepformer-libri3mix-48k/1234/save/libri3mix_test.csv
32
+ skip_prep: false
33
+
34
+ ckpt_interval_minutes: 60
35
+
36
+ # Experiment params
37
+ precision: fp16 # bf16, fp16 or fp32 # Set it to True for mixed precision
38
+ num_spks: 3
39
+ noprogressbar: false
40
+ save_audio: false # Save estimated sources on disk
41
+ sample_rate: 48000
42
+
43
+ # Training parameters
44
+ N_epochs: 50
45
+ batch_size: 1
46
+ lr: 0.0005
47
+ clip_grad_norm: 5
48
+ loss_upper_lim: 999999 # this is the upper limit for an acceptable loss
49
+ # if True, the training sequences are cut to a specified length
50
+ limit_training_signal_len: true
51
+ # this is the length of sequences if we choose to limit
52
+ # the signal length of training sequences
53
+ training_signal_len: 100000
54
+
55
+ # Set it to True to dynamically create mixtures at training time
56
+ dynamic_mixing: false
57
+ use_wham_noise: true
58
+
59
+ # Parameters for data augmentation
60
+ use_wavedrop: false
61
+ use_speedperturb: true
62
+ use_rand_shift: false
63
+ min_shift: -8000
64
+ max_shift: 8000
65
+
66
+ speedperturb: !new:speechbrain.lobes.augment.TimeDomainSpecAugment
67
+ perturb_prob: 1.0
68
+ drop_freq_prob: 0.0
69
+ drop_chunk_prob: 0.0
70
+ sample_rate: 48000
71
+ speeds: [95, 100, 105]
72
+
73
+ wavedrop: !new:speechbrain.lobes.augment.TimeDomainSpecAugment
74
+ perturb_prob: 0.0
75
+ drop_freq_prob: 1.0
76
+ drop_chunk_prob: 1.0
77
+ sample_rate: 48000
78
+
79
+ # loss thresholding -- this thresholds the training loss
80
+ threshold_byloss: true
81
+ threshold: -30
82
+
83
+ # Encoder parameters
84
+ N_encoder_out: 256
85
+ out_channels: 256
86
+ kernel_size: 16
87
+ kernel_stride: 8
88
+ d_ffn: 1024
89
+
90
+ # Dataloader options
91
+ dataloader_opts:
92
+ batch_size: 1
93
+ num_workers: 3
94
+
95
+
96
+ # Specifying the network
97
+ Encoder: &id004 !new:speechbrain.lobes.models.dual_path.Encoder
98
+ kernel_size: 16
99
+ out_channels: 256
100
+
101
+
102
+ SBtfintra: &id002 !new:speechbrain.lobes.models.dual_path.SBTransformerBlock
103
+ num_layers: 8
104
+ d_model: 256
105
+ nhead: 8
106
+ d_ffn: 1024
107
+ dropout: 0
108
+ use_positional_encoding: true
109
+ norm_before: true
110
+
111
+ SBtfinter: &id003 !new:speechbrain.lobes.models.dual_path.SBTransformerBlock
112
+ num_layers: 8
113
+ d_model: 256
114
+ nhead: 8
115
+ d_ffn: 1024
116
+ dropout: 0
117
+ use_positional_encoding: true
118
+ norm_before: true
119
+
120
+ MaskNet: &id006 !new:speechbrain.lobes.models.dual_path.Dual_Path_Model
121
+
122
+ num_spks: 3
123
+ in_channels: 256
124
+ out_channels: 256
125
+ num_layers: 2
126
+ K: 250
127
+ intra_model: *id002
128
+ inter_model: *id003
129
+ norm: ln
130
+ linear_layer_after_inter_intra: false
131
+ skip_around_intra: true
132
+
133
+ Decoder: &id005 !new:speechbrain.lobes.models.dual_path.Decoder
134
+ in_channels: 256
135
+ out_channels: 1
136
+ kernel_size: 16
137
+ stride: 8
138
+ bias: false
139
+
140
+ optimizer: !name:torch.optim.Adam
141
+ lr: 0.0005
142
+ weight_decay: 0
143
+
144
+ loss: !name:speechbrain.nnet.losses.get_si_snr_with_pitwrapper
145
+
146
+ lr_scheduler: !new:speechbrain.nnet.schedulers.ReduceLROnPlateau
147
+ factor: 0.5
148
+ patience: 2
149
+ dont_halve_until_epoch: 5
150
+
151
+ epoch_counter: &id007 !new:speechbrain.utils.epoch_loop.EpochCounter
152
+ # lr_scheduler: !ref <lr_scheduler>
153
+
154
+ limit: 50
155
+
156
+ modules:
157
+ encoder: *id004
158
+ decoder: *id005
159
+ masknet: *id006
160
+ checkpointer: !new:speechbrain.utils.checkpoints.Checkpointer
161
+ checkpoints_dir: results/sepformer-libri3mix-48k/1234/save
162
+ recoverables:
163
+ encoder: *id004
164
+ decoder: *id005
165
+ masknet: *id006
166
+ counter: *id007
167
+ train_logger: !new:speechbrain.utils.train_logger.FileTrainLogger
168
+ save_file: results/sepformer-libri3mix-48k/1234/train_log.txt
169
+
170
+
171
+ pretrainer: !new:speechbrain.utils.parameter_transfer.Pretrainer
172
+ loadables:
173
+ encoder: !ref <Encoder>
174
+ masknet: !ref <MaskNet>
175
+ decoder: !ref <Decoder>
masknet.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:94b4ef6a585db8dbb4227ecaab99e573f1c0f1fe10fda2879f099e36d76de593
3
+ size 113365891
optimizer.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:83bc94f9f931c623c0c0aca4be210eab960eb4cb7029237b7ea77915f455c031
3
+ size 206306100
scaler.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6e6fcb92f2dfc84b1e44c4aef11d4ff249f17857427a73381f8289240ee90a9a
3
+ size 557