forked from espnet/espnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee20e18
commit c1d9be5
Showing
13 changed files
with
905 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
optim: adam | ||
init: xavier_uniform | ||
max_epoch: 100 | ||
batch_type: folded | ||
batch_size: 8 | ||
iterator_type: chunk | ||
chunk_length: 32000 | ||
num_workers: 4 | ||
optim_conf: | ||
lr: 1.0e-04 | ||
eps: 1.0e-08 | ||
weight_decay: 1.0e-7 | ||
patience: 10 | ||
val_scheduler_criterion: | ||
- valid | ||
- loss | ||
best_model_criterion: | ||
- - valid | ||
- si_snr | ||
- max | ||
- - valid | ||
- loss | ||
- min | ||
keep_nbest_models: 1 | ||
scheduler: reducelronplateau | ||
scheduler_conf: | ||
mode: min | ||
factor: 0.7 | ||
patience: 1 | ||
|
||
# A list for criterions | ||
# The overlall loss in the multi-task learning will be: | ||
# loss = weight_1 * loss_1 + ... + weight_N * loss_N | ||
# The default `weight` for each sub-loss is 1.0 | ||
criterions: | ||
# The first criterion | ||
- name: mse | ||
conf: | ||
compute_on_mask: False | ||
mask_type: PSM | ||
# the wrapper for the current criterion | ||
# PIT is widely used in the speech separation task | ||
wrapper: pit | ||
wrapper_conf: | ||
weight: 1.0 | ||
|
||
encoder: stft | ||
encoder_conf: | ||
n_fft: 256 | ||
hop_length: 64 | ||
decoder: stft | ||
decoder_conf: | ||
n_fft: 256 | ||
hop_length: 64 | ||
separator: dan | ||
separator_conf: | ||
rnn_type: blstm | ||
num_spk: 2 | ||
nonlinear: tanh | ||
layer: 4 | ||
unit: 600 | ||
dropout: 0.1 | ||
emb_D: 20 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
optim: adam | ||
init: xavier_uniform | ||
max_epoch: 100 | ||
batch_type: folded | ||
batch_size: 8 | ||
num_workers: 4 | ||
optim_conf: | ||
lr: 1.0e-03 | ||
eps: 1.0e-08 | ||
weight_decay: 1.0e-7 | ||
patience: 10 | ||
val_scheduler_criterion: | ||
- valid | ||
- loss | ||
best_model_criterion: | ||
- - valid | ||
- si_snr | ||
- max | ||
- - valid | ||
- loss | ||
- min | ||
keep_nbest_models: 1 | ||
scheduler: reducelronplateau | ||
scheduler_conf: | ||
mode: min | ||
factor: 0.7 | ||
patience: 1 | ||
|
||
# A list for criterions | ||
# The overlall loss in the multi-task learning will be: | ||
# loss = weight_1 * loss_1 + ... + weight_N * loss_N | ||
# The default `weight` for each sub-loss is 1.0 | ||
criterions: | ||
# The first criterion | ||
- name: dpcl | ||
conf: | ||
loss_type: dpcl # "dpcl" or "mdc", "dpcl" means the origin loss in Deep Clustering and "mdc" means Manifold-Aware Deep Clustering | ||
# the wrapper for the current criterion | ||
# PIT is widely used in the speech separation task | ||
wrapper: dpcl | ||
wrapper_conf: | ||
weight: 1.0 | ||
|
||
encoder: stft | ||
encoder_conf: | ||
n_fft: 256 | ||
hop_length: 128 | ||
decoder: stft | ||
decoder_conf: | ||
n_fft: 256 | ||
hop_length: 128 | ||
separator: dpcl | ||
separator_conf: | ||
rnn_type: blstm | ||
num_spk: 2 | ||
nonlinear: relu | ||
layer: 2 | ||
unit: 500 | ||
dropout: 0.1 | ||
emb_D: 40 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
optim: adam | ||
init: xavier_uniform | ||
max_epoch: 100 | ||
batch_type: folded | ||
batch_size: 8 | ||
num_workers: 4 | ||
optim_conf: | ||
lr: 1.0e-03 | ||
eps: 1.0e-08 | ||
weight_decay: 1.0e-7 | ||
patience: 10 | ||
val_scheduler_criterion: | ||
- valid | ||
- loss | ||
best_model_criterion: | ||
- - valid | ||
- si_snr | ||
- max | ||
- - valid | ||
- loss | ||
- min | ||
keep_nbest_models: 1 | ||
scheduler: reducelronplateau | ||
scheduler_conf: | ||
mode: min | ||
factor: 0.7 | ||
patience: 1 | ||
|
||
# A list for criterions | ||
# The overlall loss in the multi-task learning will be: | ||
# loss = weight_1 * loss_1 + ... + weight_N * loss_N | ||
# The default `weight` for each sub-loss is 1.0 | ||
criterions: | ||
# The first criterion | ||
- name: dpcl | ||
conf: | ||
loss_type: mdc # "dpcl" or "mdc", "dpcl" means the origin loss in Deep Clustering and "mdc" means Manifold-Aware Deep Clustering | ||
# the wrapper for the current criterion | ||
# PIT is widely used in the speech separation task | ||
wrapper: dpcl | ||
wrapper_conf: | ||
weight: 1.0 | ||
|
||
encoder: stft | ||
encoder_conf: | ||
n_fft: 256 | ||
hop_length: 128 | ||
decoder: stft | ||
decoder_conf: | ||
n_fft: 256 | ||
hop_length: 128 | ||
separator: dpcl | ||
separator_conf: | ||
rnn_type: blstm | ||
num_spk: 2 | ||
nonlinear: relu | ||
layer: 2 | ||
unit: 500 | ||
dropout: 0.1 | ||
emb_D: 40 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import torch | ||
|
||
from espnet2.enh.loss.criterions.abs_loss import AbsEnhLoss | ||
from espnet2.enh.loss.wrappers.abs_wrapper import AbsLossWrapper | ||
|
||
|
||
class DPCLSolver(AbsLossWrapper): | ||
def __init__(self, criterion: AbsEnhLoss, weight=1.0): | ||
super().__init__() | ||
self.criterion = criterion | ||
self.weight = weight | ||
|
||
def forward(self, ref, inf, others={}): | ||
"""An naive DPCL solver | ||
Args: | ||
ref (List[torch.Tensor]): [(batch, ...), ...] x n_spk | ||
inf (List[torch.Tensor]): [(batch, ...), ...] | ||
Returns: | ||
loss: (torch.Tensor): minimum loss with the best permutation | ||
stats: dict, for collecting training status | ||
others: reserved | ||
""" | ||
assert "V" in others | ||
|
||
loss = self.criterion(ref, others["V"]).mean() | ||
|
||
stats = dict() | ||
stats[self.criterion.name] = loss.detach() | ||
|
||
return loss.mean(), stats, {} |
Oops, something went wrong.