Skip to content

Commit

Permalink
Merge pull request #5246 from Emrys365/tse
Browse files Browse the repository at this point in the history
Add new SE recipes: chime1/enh1, chime2/enh1, reverb/enh1, and wsj0_2mix/tse1
  • Loading branch information
sw005320 committed Jun 22, 2023
2 parents 753d847 + df56b29 commit b5a88e9
Show file tree
Hide file tree
Showing 114 changed files with 2,831 additions and 3 deletions.
2 changes: 1 addition & 1 deletion egs/chime4/asr1/local/find_noisy_transcripts.pl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# dataset (represented by a file list).
#

@ARGV == 1 || die "find_transcripts.pl dot_files_flist < utterance_ids > transcripts";
@ARGV == 1 || die "find_noisy_transcripts.pl dot_files_flist < utterance_ids > transcripts";
$dot_flist = shift @ARGV;

open(L, "<$dot_flist") || die "Opening file list of dot files: $dot_flist\n";
Expand Down
2 changes: 2 additions & 0 deletions egs2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ See: https://espnet.github.io/espnet/espnet2_tutorial.html#recipes-using-espnet2
| bur_openslr80 | Burmese ASR training dataset | ASR | BUR | https://openslr.org/80/ | |
| catslu | CATSLU-MAPS | SLU | CMN | https://sites.google.com/view/catslu/home | |
| catslu_entity | CATSLU | SLU/Entity Classifi. | CMN | https://sites.google.com/view/catslu/home | |
| chime1 | The 1st CHiME Speech Separation and Recognition Challenge | ASR/Multichannel ASR | ENG | https://spandh.dcs.shef.ac.uk/chime_challenge/chime2011/ | |
| chime2 | The 2nd CHiME Speech Separation and Recognition Challenge | ASR/Multichannel ASR | ENG | https://spandh.dcs.shef.ac.uk/chime_challenge/chime2013/ | |
| chime4 | The 4th CHiME Speech Separation and Recognition Challenge | ASR/Multichannel ASR | ENG | http://spandh.dcs.shef.ac.uk/chime_challenge/chime2016/ | |
| chime6 | The 6th CHiME Speech Separation and Recognition Challenge | ASR | ENG | https://chimechallenge.github.io/chime6/ | |
| clarity21 | The First Clarity Enhancement Challenge CEC1 | SE | ENG | https://claritychallenge.github.io/clarity_CEC1_doc/ | |
Expand Down
3 changes: 3 additions & 0 deletions egs2/TEMPLATE/asr1/db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ WSJCAM0=
REAZONSPEECH=downloads
REVERB=
REVERB_OUT="${PWD}/REVERB" # Output file path
CHIME1=
CHIME2_WSJ0=
CHIME2_GRID=
CHIME3=
CHIME4=
CHIME5=
Expand Down
110 changes: 110 additions & 0 deletions egs2/chime1/enh1/cmd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# ====== About run.pl, queue.pl, slurm.pl, and ssh.pl ======
# Usage: <cmd>.pl [options] JOB=1:<nj> <log> <command...>
# e.g.
# run.pl --mem 4G JOB=1:10 echo.JOB.log echo JOB
#
# Options:
# --time <time>: Limit the maximum time to execute.
# --mem <mem>: Limit the maximum memory usage.
# -–max-jobs-run <njob>: Limit the number parallel jobs. This is ignored for non-array jobs.
# --num-threads <ngpu>: Specify the number of CPU core.
# --gpu <ngpu>: Specify the number of GPU devices.
# --config: Change the configuration file from default.
#
# "JOB=1:10" is used for "array jobs" and it can control the number of parallel jobs.
# The left string of "=", i.e. "JOB", is replaced by <N>(Nth job) in the command and the log file name,
# e.g. "echo JOB" is changed to "echo 3" for the 3rd job and "echo 8" for 8th job respectively.
# Note that the number must start with a positive number, so you can't use "JOB=0:10" for example.
#
# run.pl, queue.pl, slurm.pl, and ssh.pl have unified interface, not depending on its backend.
# These options are mapping to specific options for each backend and
# it is configured by "conf/queue.conf" and "conf/slurm.conf" by default.
# If jobs failed, your configuration might be wrong for your environment.
#
#
# The official documentation for run.pl, queue.pl, slurm.pl, and ssh.pl:
# "Parallelization in Kaldi": http://kaldi-asr.org/doc/queue.html
# =========================================================~


# Select the backend used by run.sh from "local", "stdout", "sge", "slurm", or "ssh"
cmd_backend='local'

# Local machine, without any Job scheduling system
if [ "${cmd_backend}" = local ]; then

# The other usage
export train_cmd="run.pl"
# Used for "*_train.py": "--gpu" is appended optionally by run.sh
export cuda_cmd="run.pl"
# Used for "*_recog.py"
export decode_cmd="run.pl"

# Local machine logging to stdout and log file, without any Job scheduling system
elif [ "${cmd_backend}" = stdout ]; then

# The other usage
export train_cmd="stdout.pl"
# Used for "*_train.py": "--gpu" is appended optionally by run.sh
export cuda_cmd="stdout.pl"
# Used for "*_recog.py"
export decode_cmd="stdout.pl"


# "qsub" (Sun Grid Engine, or derivation of it)
elif [ "${cmd_backend}" = sge ]; then
# The default setting is written in conf/queue.conf.
# You must change "-q g.q" for the "queue" for your environment.
# To know the "queue" names, type "qhost -q"
# Note that to use "--gpu *", you have to setup "complex_value" for the system scheduler.

export train_cmd="queue.pl"
export cuda_cmd="queue.pl"
export decode_cmd="queue.pl"


# "qsub" (Torque/PBS.)
elif [ "${cmd_backend}" = pbs ]; then
# The default setting is written in conf/pbs.conf.

export train_cmd="pbs.pl"
export cuda_cmd="pbs.pl"
export decode_cmd="pbs.pl"


# "sbatch" (Slurm)
elif [ "${cmd_backend}" = slurm ]; then
# The default setting is written in conf/slurm.conf.
# You must change "-p cpu" and "-p gpu" for the "partition" for your environment.
# To know the "partion" names, type "sinfo".
# You can use "--gpu * " by default for slurm and it is interpreted as "--gres gpu:*"
# The devices are allocated exclusively using "${CUDA_VISIBLE_DEVICES}".

export train_cmd="slurm.pl"
export cuda_cmd="slurm.pl"
export decode_cmd="slurm.pl"

elif [ "${cmd_backend}" = ssh ]; then
# You have to create ".queue/machines" to specify the host to execute jobs.
# e.g. .queue/machines
# host1
# host2
# host3
# Assuming you can login them without any password, i.e. You have to set ssh keys.

export train_cmd="ssh.pl"
export cuda_cmd="ssh.pl"
export decode_cmd="ssh.pl"

# This is an example of specifying several unique options in the JHU CLSP cluster setup.
# Users can modify/add their own command options according to their cluster environments.
elif [ "${cmd_backend}" = jhu ]; then

export train_cmd="queue.pl --mem 2G"
export cuda_cmd="queue-freegpu.pl --mem 2G --gpu 1 --config conf/queue.conf"
export decode_cmd="queue.pl --mem 4G"

else
echo "$0: Error: Unknown cmd_backend=${cmd_backend}" 1>&2
return 1
fi
11 changes: 11 additions & 0 deletions egs2/chime1/enh1/conf/pbs.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Default configuration
command qsub -V -v PATH -S /bin/bash
option name=* -N $0
option mem=* -l mem=$0
option mem=0 # Do not add anything to qsub_opts
option num_threads=* -l ncpus=$0
option num_threads=1 # Do not add anything to qsub_opts
option num_nodes=* -l nodes=$0:ppn=1
default gpu=0
option gpu=0
option gpu=* -l ngpus=$0
12 changes: 12 additions & 0 deletions egs2/chime1/enh1/conf/queue.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Default configuration
command qsub -v PATH -cwd -S /bin/bash -j y -l arch=*64*
option name=* -N $0
option mem=* -l mem_free=$0,ram_free=$0
option mem=0 # Do not add anything to qsub_opts
option num_threads=* -pe smp $0
option num_threads=1 # Do not add anything to qsub_opts
option max_jobs_run=* -tc $0
option num_nodes=* -pe mpi $0 # You must set this PE as allocation_rule=1
default gpu=0
option gpu=0
option gpu=* -l gpu=$0 -q g.q
14 changes: 14 additions & 0 deletions egs2/chime1/enh1/conf/slurm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Default configuration
command sbatch --export=PATH
option name=* --job-name $0
option time=* --time $0
option mem=* --mem-per-cpu $0
option mem=0
option num_threads=* --cpus-per-task $0
option num_threads=1 --cpus-per-task 1
option num_nodes=* --nodes $0
default gpu=0
option gpu=0 -p cpu
option gpu=* -p gpu --gres=gpu:$0 -c $0 # Recommend allocating more CPU than, or equal to the number of GPU
# note: the --max-jobs-run option is supported as a special case
# by slurm.pl and you don't have to handle it in the config file.
72 changes: 72 additions & 0 deletions egs2/chime1/enh1/conf/tuning/train_enh_beamformer_mvdr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
optim: adam
init: xavier_uniform
max_epoch: 70
batch_type: folded
batch_size: 8
num_workers: 4
optim_conf:
lr: 1.0e-03
eps: 1.0e-08
weight_decay: 0
patience: 4
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.5
patience: 1
encoder: stft
encoder_conf:
n_fft: 512
hop_length: 128
use_builtin_complex: False
decoder: stft
decoder_conf:
n_fft: 512
hop_length: 128
separator: wpe_beamformer
separator_conf:
num_spk: 1
loss_type: mask_mse
use_wpe: False
wnet_type: blstmp
wlayers: 3
wunits: 300
wprojs: 320
wdropout_rate: 0.0
taps: 5
delay: 3
use_dnn_mask_for_wpe: True
use_beamformer: True
bnet_type: blstmp
blayers: 3
bunits: 512
bprojs: 512
badim: 320
ref_channel: 3
use_noise_mask: True
beamformer_type: mvdr_souden
bdropout_rate: 0.0


criterions:
# The first criterion
- name: mse
conf:
compute_on_mask: True
mask_type: PSM^2
# the wrapper for the current criterion
# for single-talker case, we simplely use fixed_order wrapper
wrapper: fixed_order
wrapper_conf:
weight: 1.0
1 change: 1 addition & 0 deletions egs2/chime1/enh1/db.sh
1 change: 1 addition & 0 deletions egs2/chime1/enh1/enh.sh
70 changes: 70 additions & 0 deletions egs2/chime1/enh1/local/create_chime1_trans.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env perl
#
# Copyright 2015 University of Sheffield (Author: Ning Ma)
# Apache 2.0.
#
# Create transcriptions for the CHIME/GRID corpus from a list of
# file names (used as UTTERANCE-ID, e.g. s1_bgab3n)
# It outputs lines containing UTTERANCE-ID TRANSCRIPTIONS, e.g.
# s1_bgab3n BIN GREEN AT B THREE NOW
#
# Usage: create_chime1_trans.pl train.flist

use strict;
use warnings;

# Define silence label at begin/end of an utternace
my $sil = "<SIL>";

my $in_list = $ARGV[0];

open my $info, $in_list or die "could not open $in_list: $!";

while (my $line = <$info>) {
chomp($line);
$line =~ s/\.[^.]+$//; # Remove extension just in case
my @tokens = split("_", $line);
my @chars = split("", $tokens[1]);
my $trans;

if ($chars[0] eq "b") { $trans = "BIN"}
elsif ($chars[0] eq "l") { $trans = "LAY" }
elsif ($chars[0] eq "p") { $trans = "PLACE" }
elsif ($chars[0] eq "s") { $trans = "SET" }
else { $trans = "!UNKNOWN"}

if ($chars[1] eq "b") { $trans = $trans . " BLUE" }
elsif ($chars[1] eq "g") { $trans = $trans . " GREEN" }
elsif ($chars[1] eq "r") { $trans = $trans . " RED" }
elsif ($chars[1] eq "w") { $trans = $trans . " WHITE" }
else { $trans = $trans . "!UNKNOWN"}

if ($chars[2] eq "a") { $trans = $trans . " AT" }
elsif ($chars[2] eq "b") { $trans = $trans . " BY" }
elsif ($chars[2] eq "i") { $trans = $trans . " IN" }
elsif ($chars[2] eq "w") { $trans = $trans . " WITH" }
else { $trans = $trans . "!UNKNOWN"}

$trans = $trans . " " . uc($chars[3]);

if ($chars[4] eq "z") { $trans = $trans . " ZERO" }
elsif ($chars[4] eq "1") { $trans = $trans . " ONE" }
elsif ($chars[4] eq "2") { $trans = $trans . " TWO" }
elsif ($chars[4] eq "3") { $trans = $trans . " THREE" }
elsif ($chars[4] eq "4") { $trans = $trans . " FOUR" }
elsif ($chars[4] eq "5") { $trans = $trans . " FIVE" }
elsif ($chars[4] eq "6") { $trans = $trans . " SIX" }
elsif ($chars[4] eq "7") { $trans = $trans . " SEVEN" }
elsif ($chars[4] eq "8") { $trans = $trans . " EIGHT" }
elsif ($chars[4] eq "9") { $trans = $trans . " NINE" }
else { $trans = $trans . "!UNKNOWN"}

if ($chars[5] eq "a") { $trans = $trans . " AGAIN" }
elsif ($chars[5] eq "n") { $trans = $trans . " NOW" }
elsif ($chars[5] eq "p") { $trans = $trans . " PLEASE" }
elsif ($chars[5] eq "s") { $trans = $trans . " SOON" }
else { $trans = $trans . "!UNKNOWN"}

#print "$line $sil $trans $sil\n";
print "$line\t$trans\n";
}

0 comments on commit b5a88e9

Please sign in to comment.