Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8'
- uses: pre-commit/action@v2.0.3
python-version: '3.12'
- uses: pre-commit/action@v3.0.1
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0 # Use the ref you want to point at
rev: v5.0.0 # Use the ref you want to point at
hooks:
- id: trailing-whitespace
types: [file, text]
Expand All @@ -21,7 +21,7 @@ repos:
types: [python]
additional_dependencies: ['click==8.0.4']
- repo: https://github.com/PyCQA/flake8
rev: 3.7.9
rev: 7.0.0
hooks:
- id: flake8
types: [python]
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/CL_MASR/analyze_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def plot_wer(
plt.xticks(range(len(locales)), locales, rotation=90)
if xlabel is not None:
plt.xlabel(xlabel)
plt.ylabel("WER (\%)" if usetex else "WER (%)") # noqa: W605
plt.ylabel("WER (\\%)" if usetex else "WER (%)") # noqa: W605
fig.tight_layout()
plt.savefig(output_image, bbox_inches="tight")
plt.close()
Expand Down Expand Up @@ -851,7 +851,7 @@ def hex_to_rgb(hex_color: "str") -> "Tuple":
f"{name.lower().replace(' ', '_')}.{args.format}",
),
xlabel=None,
ylabel=f"{name} (\%)"
ylabel=f"{name} (\\%)"
if args.usetex
else f"{name} (%)", # noqa: W605
xticks=["base"] + [f"L{i}" for i in range(1, 1 + len(new_locales))],
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/CL_MASR/common_voice_prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def prepare_common_voice(
_LOGGER.info(
"----------------------------------------------------------------------",
)
_LOGGER.info(f"Merging TSV files...")
_LOGGER.info("Merging TSV files...")
for split, max_duration in zip(_SPLITS, max_durations):
tsv_files = [
os.path.join(data_folder, locale, f"{split}_with_duration.tsv")
Expand All @@ -126,7 +126,7 @@ def prepare_common_voice(
_LOGGER.info(
"----------------------------------------------------------------------",
)
_LOGGER.info(f"Creating data manifest CSV files...")
_LOGGER.info("Creating data manifest CSV files...")
for split in _SPLITS:
preprocess_tsv_file(
os.path.join(data_folder, f"{split}_with_duration.tsv"),
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/wavlm/pretrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def train(hparams, run_opts):

# Testing
test(
hparams, run_opts, hparams["locales"], f"wer_test.txt",
hparams, run_opts, hparams["locales"], "wer_test.txt",
)


Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/wavlm/train_agem.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def train(hparams, run_opts):

# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/wavlm/train_der.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def train(hparams, run_opts):

# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

replay_buffer = []
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/wavlm/train_er.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def train(hparams, run_opts):

# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/wavlm/train_ewc.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def train(hparams, run_opts):

# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/wavlm/train_ft.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def train(hparams, run_opts):

# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/CL_MASR/wavlm/train_joint.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def train(hparams, run_opts):

# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down Expand Up @@ -358,7 +358,7 @@ def train(hparams, run_opts):
hparams,
run_opts,
hparams["base_locales"] + hparams["new_locales"],
f"wer_test_after.txt",
"wer_test_after.txt",
)


Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/wavlm/train_l2p.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def train(hparams, run_opts):

# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/wavlm/train_lwf.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def train(hparams, run_opts):

# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/wavlm/train_mas.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def train(hparams, run_opts):

# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/wavlm/train_pb.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def train(hparams, run_opts):

# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/wavlm/train_pnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def train(hparams, run_opts):

# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down
10 changes: 5 additions & 5 deletions benchmarks/CL_MASR/whisper/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def generate(
if forced_decoder_locale is None:
# Compute most likely language token IDs
all_lang_tokens = [
f"<|{l}|>" for l in self.tokenizer.supported_languages
f"<|{lang}|>" for lang in self.tokenizer.supported_languages
]
all_lang_tokens_ids = self.tokenizer.convert_tokens_to_ids(
all_lang_tokens
Expand Down Expand Up @@ -383,8 +383,8 @@ def _greedy_search(
alive_mask_unchanged = gen_token_ids != endoftext_id
if not alive_mask_unchanged.all():
alive_mask[
alive_mask == True
] = alive_mask_unchanged # noqa: E712
alive_mask == True # noqa: E712
] = alive_mask_unchanged
if not alive_mask.any():
break
# B* x S x F
Expand Down Expand Up @@ -567,8 +567,8 @@ def _beam_search(
alive_mask_unchanged = end_idxes < beam_size
if not alive_mask_unchanged.all():
alive_mask[
alive_mask == True
] = alive_mask_unchanged # noqa: E712
alive_mask == True # noqa: E712
] = alive_mask_unchanged
if not alive_mask.any():
break
# N x B* x S x F
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/whisper/train_agem.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def train(hparams, run_opts):
"""
# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/whisper/train_der.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def train(hparams, run_opts):
"""
# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

replay_buffer = []
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/whisper/train_er.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def train(hparams, run_opts):
"""
# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/whisper/train_ewc.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def train(hparams, run_opts):
"""
# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/whisper/train_ft.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def train(hparams, run_opts):
"""
# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/CL_MASR/whisper/train_joint.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def train(hparams, run_opts):
"""
# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down Expand Up @@ -413,7 +413,7 @@ def train(hparams, run_opts):
hparams,
run_opts,
hparams["base_locales"] + hparams["new_locales"],
f"wer_test_after.txt",
"wer_test_after.txt",
)


Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/whisper/train_l2p.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def train(hparams, run_opts):
"""
# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/whisper/train_lwf.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def train(hparams, run_opts):
"""
# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/whisper/train_mas.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def train(hparams, run_opts):
"""
# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/whisper/train_pb.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def train(hparams, run_opts):

# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CL_MASR/whisper/train_pnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def train(hparams, run_opts):
"""
# Testing
test(
hparams, run_opts, hparams["base_locales"], f"wer_test_before.txt",
hparams, run_opts, hparams["base_locales"], "wer_test_before.txt",
)

# Train on new locales
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/DASB/IEMOCAP/iemocap_prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def load_utterInfo(inputFile):
# [START_TIME - END_TIME] TURN_NAME EMOTION [V, A, D]
# [V, A, D] means [Valence, Arousal, Dominance]
pattern = re.compile(
"[\[]*[0-9]*[.][0-9]*[ -]*[0-9]*[.][0-9]*[\]][\t][a-z0-9_]*[\t][a-z]{3}[\t][\[][0-9]*[.][0-9]*[, ]+[0-9]*[.][0-9]*[, ]+[0-9]*[.][0-9]*[\]]",
"[\[]*[0-9]*[.][0-9]*[ -]*[0-9]*[.][0-9]*[\]][\t][a-z0-9_]*[\t][a-z]{3}[\t][\[][0-9]*[.][0-9]*[, ]+[0-9]*[.][0-9]*[, ]+[0-9]*[.][0-9]*[\]]", # noqa
re.IGNORECASE,
) # noqa
with open(inputFile, "r") as myfile:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def on_stage_end(self, stage, stage_loss, epoch=None):
)
hparams["train_logger"].log_stats(
stats_meta={
f"SSL parameters/buffers (M)": f"{ssl_params / 1e6:.2f}",
"SSL parameters/buffers (M)": f"{ssl_params / 1e6:.2f}",
"Model parameters/buffers (M)": f"{model_params / 1e6:.2f}",
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def toks_to_sig(self, toks):
)
hparams["train_logger"].log_stats(
stats_meta={
f"Codec parameters/buffers (M)": f"{codec_params / 1e6:.2f}",
"Codec parameters/buffers (M)": f"{codec_params / 1e6:.2f}",
"Model parameters/buffers (M)": f"{model_params / 1e6:.2f}",
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def toks_to_sig(self, toks):
)
hparams["train_logger"].log_stats(
stats_meta={
f"Codec parameters/buffers (M)": f"{codec_params / 1e6:.2f}",
"Codec parameters/buffers (M)": f"{codec_params / 1e6:.2f}",
"Model parameters/buffers (M)": f"{model_params / 1e6:.2f}",
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def on_stage_end(self, stage, stage_loss, epoch=None):
)
hparams["train_logger"].log_stats(
stats_meta={
f"Codec parameters/buffers (M)": f"{codec_params / 1e6:.2f}",
"Codec parameters/buffers (M)": f"{codec_params / 1e6:.2f}",
"Model parameters/buffers (M)": f"{model_params / 1e6:.2f}",
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def toks_to_sig(self, toks):
)
hparams["train_logger"].log_stats(
stats_meta={
f"Codec parameters/buffers (M)": f"{codec_params / 1e6:.2f}",
"Codec parameters/buffers (M)": f"{codec_params / 1e6:.2f}",
"Model parameters/buffers (M)": f"{model_params / 1e6:.2f}",
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def on_stage_end(self, stage, stage_loss, epoch=None):
)
hparams["train_logger"].log_stats(
stats_meta={
f"SSL parameters/buffers (M)": f"{ssl_params / 1e6:.2f}",
"SSL parameters/buffers (M)": f"{ssl_params / 1e6:.2f}",
"Model parameters/buffers (M)": f"{model_params / 1e6:.2f}",
},
)
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/DASB/Libri2Mix/separation/crdnn/train_dac.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def toks_to_sig(self, toks):
)
hparams["train_logger"].log_stats(
stats_meta={
f"Codec parameters/buffers (M)": f"{codec_params / 1e6:.2f}",
"Codec parameters/buffers (M)": f"{codec_params / 1e6:.2f}",
"Model parameters/buffers (M)": f"{model_params / 1e6:.2f}",
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def toks_to_sig(self, toks):
)
hparams["train_logger"].log_stats(
stats_meta={
f"Codec parameters/buffers (M)": f"{codec_params / 1e6:.2f}",
"Codec parameters/buffers (M)": f"{codec_params / 1e6:.2f}",
"Model parameters/buffers (M)": f"{model_params / 1e6:.2f}",
},
)
Expand Down
Loading