From 322f954aa4bf1c9adfab356140f97aabbc82ee33 Mon Sep 17 00:00:00 2001 From: Yifan Yang Date: Wed, 8 Mar 2023 11:17:21 +0800 Subject: [PATCH] Fix for style check --- .../train_hard_1.py | 8 +++++--- .../train_hard_2.py | 8 +++++--- .../train_soft_0.03.py | 12 +++++++----- .../train_soft_0.04.py | 12 +++++++----- .../train_soft_0.05.py | 12 +++++++----- .../train_soft_5.py | 12 +++++++----- 6 files changed, 38 insertions(+), 26 deletions(-) diff --git a/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_hard_1.py b/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_hard_1.py index 018c62784..6c1dab32b 100755 --- a/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_hard_1.py +++ b/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_hard_1.py @@ -27,7 +27,7 @@ export CUDA_VISIBLE_DEVICES="0,1,2,3" --world-size 4 \ --num-epochs 40 \ --start-epoch 21 \ - --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_0.85_hard_1.py \ + --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_21to40_hard_1.py \ --full-libri 1 \ --max-duration 300 @@ -38,7 +38,7 @@ export CUDA_VISIBLE_DEVICES="0,1,2,3" --num-epochs 40 \ --start-epoch 21 \ --use-fp16 1 \ - --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_0.85_hard_1.py \ + --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_21to40_hard_1.py \ --full-libri 1 \ --max-duration 750 """ @@ -697,7 +697,9 @@ def compute_loss( ) # Works with a BPE model - decoding_graph = k2.fast_ctc_graph(token_ids, modified=False, device=device, max_repeat=1) + decoding_graph = k2.fast_ctc_graph( + token_ids, modified=False, device=device, max_repeat=1 + ) dense_fsa_vec = k2.DenseFsaVec( ctc_output, supervision_segments, diff --git a/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_hard_2.py b/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_hard_2.py index e2dfa2752..3065e1afb 100755 --- a/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_hard_2.py +++ b/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_hard_2.py @@ -27,7 +27,7 @@ export CUDA_VISIBLE_DEVICES="0,1,2,3" --world-size 4 \ --num-epochs 40 \ --start-epoch 21 \ - --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_0.85_hard_2.py \ + --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_21to40_hard_2.py \ --full-libri 1 \ --max-duration 300 @@ -38,7 +38,7 @@ export CUDA_VISIBLE_DEVICES="0,1,2,3" --num-epochs 40 \ --start-epoch 21 \ --use-fp16 1 \ - --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_0.85_hard_2.py \ + --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_21to40_hard_2.py \ --full-libri 1 \ --max-duration 750 """ @@ -697,7 +697,9 @@ def compute_loss( ) # Works with a BPE model - decoding_graph = k2.fast_ctc_graph(token_ids, modified=False, device=device, max_repeat=2) + decoding_graph = k2.fast_ctc_graph( + token_ids, modified=False, device=device, max_repeat=2 + ) dense_fsa_vec = k2.DenseFsaVec( ctc_output, supervision_segments, diff --git a/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_soft_0.03.py b/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_soft_0.03.py index 9ae1a99d4..fcb6c4c24 100755 --- a/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_soft_0.03.py +++ b/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_soft_0.03.py @@ -27,7 +27,7 @@ export CUDA_VISIBLE_DEVICES="0,1,2,3" --world-size 4 \ --num-epochs 40 \ --start-epoch 21 \ - --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_soft_0.03 \ + --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_21to40_soft_0.03 \ --full-libri 1 \ --max-duration 300 @@ -38,7 +38,7 @@ export CUDA_VISIBLE_DEVICES="0,1,2,3" --num-epochs 40 \ --start-epoch 21 \ --use-fp16 1 \ - --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_soft_0.03 \ + --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_21to40_soft_0.03 \ --full-libri 1 \ --max-duration 750 """ @@ -705,10 +705,12 @@ def compute_loss( ) # non-blank arcs self-loop penalty - all_self_blanks_idx = decoding_graph.arcs.values()[:, 0] == decoding_graph.arcs.values()[:, 1] + all_self_blanks_idx = ( + decoding_graph.arcs.values()[:, 0] == decoding_graph.arcs.values()[:, 1] + ) blank_self_loops_idx = decoding_graph.arcs.values()[:, 2] == 0 - decoding_graph.scores[all_self_blanks_idx] = -0.03 - decoding_graph.scores[blank_self_loops_idx] = 0.0 + decoding_graph.scores[all_self_blanks_idx] = -0.03 + decoding_graph.scores[blank_self_loops_idx] = 0.0 ctc_loss = k2.ctc_loss( decoding_graph=decoding_graph, diff --git a/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_soft_0.04.py b/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_soft_0.04.py index acb8a103e..4d3795d3c 100755 --- a/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_soft_0.04.py +++ b/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_soft_0.04.py @@ -27,7 +27,7 @@ export CUDA_VISIBLE_DEVICES="0,1,2,3" --world-size 4 \ --num-epochs 40 \ --start-epoch 21 \ - --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_soft_0.04 \ + --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_21to40_soft_0.04 \ --full-libri 1 \ --max-duration 300 @@ -38,7 +38,7 @@ export CUDA_VISIBLE_DEVICES="0,1,2,3" --num-epochs 40 \ --start-epoch 21 \ --use-fp16 1 \ - --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_soft_0.04 \ + --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_21to40_soft_0.04 \ --full-libri 1 \ --max-duration 750 """ @@ -705,10 +705,12 @@ def compute_loss( ) # non-blank arcs self-loop penalty - all_self_blanks_idx = decoding_graph.arcs.values()[:, 0] == decoding_graph.arcs.values()[:, 1] + all_self_blanks_idx = ( + decoding_graph.arcs.values()[:, 0] == decoding_graph.arcs.values()[:, 1] + ) blank_self_loops_idx = decoding_graph.arcs.values()[:, 2] == 0 - decoding_graph.scores[all_self_blanks_idx] = -0.04 - decoding_graph.scores[blank_self_loops_idx] = 0.0 + decoding_graph.scores[all_self_blanks_idx] = -0.04 + decoding_graph.scores[blank_self_loops_idx] = 0.0 ctc_loss = k2.ctc_loss( decoding_graph=decoding_graph, diff --git a/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_soft_0.05.py b/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_soft_0.05.py index a5701c98e..37f37c9a1 100755 --- a/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_soft_0.05.py +++ b/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_soft_0.05.py @@ -27,7 +27,7 @@ export CUDA_VISIBLE_DEVICES="0,1,2,3" --world-size 4 \ --num-epochs 40 \ --start-epoch 21 \ - --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_soft_0.05 \ + --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_21to40_soft_0.05 \ --full-libri 1 \ --max-duration 300 @@ -38,7 +38,7 @@ export CUDA_VISIBLE_DEVICES="0,1,2,3" --num-epochs 40 \ --start-epoch 21 \ --use-fp16 1 \ - --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_soft_0.05 \ + --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_21to40_soft_0.05 \ --full-libri 1 \ --max-duration 750 """ @@ -705,10 +705,12 @@ def compute_loss( ) # non-blank arcs self-loop penalty - all_self_blanks_idx = decoding_graph.arcs.values()[:, 0] == decoding_graph.arcs.values()[:, 1] + all_self_blanks_idx = ( + decoding_graph.arcs.values()[:, 0] == decoding_graph.arcs.values()[:, 1] + ) blank_self_loops_idx = decoding_graph.arcs.values()[:, 2] == 0 - decoding_graph.scores[all_self_blanks_idx] = -0.05 - decoding_graph.scores[blank_self_loops_idx] = 0.0 + decoding_graph.scores[all_self_blanks_idx] = -0.05 + decoding_graph.scores[blank_self_loops_idx] = 0.0 ctc_loss = k2.ctc_loss( decoding_graph=decoding_graph, diff --git a/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_soft_5.py b/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_soft_5.py index 4c9778d8b..25a6d9a49 100755 --- a/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_soft_5.py +++ b/egs/librispeech/ASR/pruned_transducer_stateless4_ctc_bs/train_soft_5.py @@ -27,7 +27,7 @@ export CUDA_VISIBLE_DEVICES="0,1,2,3" --world-size 4 \ --num-epochs 40 \ --start-epoch 21 \ - --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_soft_5 \ + --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_21to40_soft_5 \ --full-libri 1 \ --max-duration 300 @@ -38,7 +38,7 @@ export CUDA_VISIBLE_DEVICES="0,1,2,3" --num-epochs 40 \ --start-epoch 21 \ --use-fp16 1 \ - --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_soft_5 \ + --exp-dir pruned_transducer_stateless4_ctc_bs_withoutlconv/exp_960_21to40_soft_5 \ --full-libri 1 \ --max-duration 750 """ @@ -705,10 +705,12 @@ def compute_loss( ) # non-blank arcs self-loop penalty - all_self_blanks_idx = decoding_graph.arcs.values()[:, 0] == decoding_graph.arcs.values()[:, 1] + all_self_blanks_idx = ( + decoding_graph.arcs.values()[:, 0] == decoding_graph.arcs.values()[:, 1] + ) blank_self_loops_idx = decoding_graph.arcs.values()[:, 2] == 0 - decoding_graph.scores[all_self_blanks_idx] = -5.00 - decoding_graph.scores[blank_self_loops_idx] = 0.0 + decoding_graph.scores[all_self_blanks_idx] = -5.00 + decoding_graph.scores[blank_self_loops_idx] = 0.0 ctc_loss = k2.ctc_loss( decoding_graph=decoding_graph,