forked from CPJKU/dcase2024_task1_baseline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmulti_run_gpu1.py
92 lines (77 loc) · 5.11 KB
/
multi_run_gpu1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# multi_run.py
# def run_multiple_scripts(scripts_with_args):
# try:
# for script_name, args in scripts_with_args:
# subprocess.run(['python', script_name] + args)
# except Exception as e:
# print(f"An error occurred: {e}")
# if __name__ == "__main__":
# # Example: Replace these with your actual script names and arguments
# scripts_to_run = [
# ('run_passt_cochl_PT_mel_h5.py', ['--lr', 1e-4]),
# ('run_passt_cochl_PT_mel_h5.py', [ '--lr', 1e-5]),
# ('run_passt_cochl_PT_mel_h5.py', [ '--lr', 1e-6])
# ]
# run_multiple_scripts(scripts_to_run)
# import subprocess
import subprocess
def run_multiple_scripts(script_name, base_args, ckpt_experiment_pairs, num_repeats):
try:
for ckpt_id, experiment_name in ckpt_experiment_pairs:
# Update arguments with the current ckpt_id and experiment_name
ckpt_id_arg = "None" if ckpt_id is None else ckpt_id
args = base_args + ["--ckpt_id", ckpt_id_arg, "--experiment_name", experiment_name]
# Run the script multiple times with the same arguments
for _ in range(num_repeats):
subprocess.run(['python', script_name] + args)
except Exception as e:
print(f"An error occurred: {e}")
### How to use this script###
# 1. Check the script name to ensure you are distilling from the correct teacher ensemble
# 2. Check base args for subset and augmentations
# 3. Check model variants and individual Checkpoint IDs
if __name__ == "__main__":
# Define the script to run
# script_name = 'run_training_dev_h5.py'
# script_name = 'run_passt_cochl_tau_slowfast_subsets_DIR_FMS_h5.py'
script_name = 'run_training_DynMN_h5_PL.py'
# Base arguments (common to all runs, except experiment name and ckpt_id)
base_args = ['--gpu','[1]',"--subset", "5", "--dir_prob", "0.6", "--mixstyle_p", "0.4", "--batch_size", "48", "--model_width", "2.0"]
# List of tuples containing checkpoint IDs and their corresponding experiment names
ckpt_experiment_pairs = [
# ("utupypwc", "sBCBL_FTcs_FTtau_wk50wxro_sub10_FMS_DIR_fixh5"), #SeqFT 1e-4
# ("0r39k52v", "sBCBL_FTcs_FTtau_qrrag30b_sub10_FMS_DIR_fixh5"), #SeqFT 1e-5
# ("6ip7syrn", "sBCBL_FTcs_FTtau_7qghtor2_sub10_FMS_DIR_fixh5"), #SeqFT 1e-6
# ("wk50wxro", "sBCBL_SLcs_FTtau_wk50wxro_sub10_FMS_DIR_fixh5"), #SL 1e-4 SIT
# ("qrrag30b", "sBCBL_SLcs_FTtau_qrrag30b_sub10_FMS_DIR_fixh5"), #SL 1e-5 SIT
# ("7qghtor2", "sBCBL_SLcs_FTtau_7qghtor2_sub10_FMS_DIR_fixh5") #SL 1e-6 SIT
# ("wk50wxro", "sBCBL_SLcs_SLtau_wk50wxro_sub10_FMS_DIR_fixh5"), #SL 1e-4 DSIT
# ("qrrag30b", "sBCBL_SLcs_SLtau_qrrag30b_sub10_FMS_DIR_fixh5"), #SL 1e-5 DSIT
# ("7qghtor2", "sBCBL_SLcs_SLtau_7qghtor2_sub10_FMS_DIR_fixh5") #SL 1e-6 DSIT
# (None, "sBCBL_FTtau_sub10_FMS_DIR_fixh5") #PTau First model trained used mixup, have disabled default mixup for the next 5
(None, "tDynMN20_FTtau_32K_FMS_DIR_sub25_fixh5") #DyMN20 FTtau
]
# Number of times to repeat each experiment
num_repeats = 2
# Run the script with different checkpoint IDs and experiment names
run_multiple_scripts(script_name, base_args, ckpt_experiment_pairs, num_repeats)
# import subprocess
# def run_multiple_scripts(scripts_with_args):
# try:
# for script_name, args in scripts_with_args:
# # Convert all arguments to strings
# args = [str(arg) for arg in args]
# subprocess.run(['python', script_name] + args)
# except Exception as e:
# print(f"An error occurred: {e}")
# if __name__ == "__main__":
# # Example: Replace these with your actual script names and arguments
# scripts_to_run = [
# # ('run_passt_KD_Cochl_TAU_FT_subsets_DIR_FMS_h5_multirun_copy.py', [ "--subset", "5", "--dir_prob", "0.6","--ckpt_id", "fskag87u", "--experiment_name", "NTU_KD_Var3b-T_DSIT-S_FMS_DIR_sub5_fixh5"]),
# # ('run_passt_KD_Cochl_TAU_FT_subsets_DIR_FMS_h5_multirun_copy.py', [ "--subset", "5", "--dir_prob", "0.6","--ckpt_id", "fskag87u", "--experiment_name", "NTU_KD_Var3b-T_DSIT-S_FMS_DIR_sub5_fixh5"]),
# ('run_passt_KD_Cochl_TAU_FT_subsets_DIR_FMS_h5_multirun_copy.py', [ "--subset", "5", "--dir_prob", "0.6","--ckpt_id", "fskag87u", "--experiment_name", "NTU_KD_Var3b-T_DSIT-S_FMS_DIR_sub5_fixh5"]),
# ('run_passt_KD_Cochl_TAU_FT_subsets_DIR_FMS_h5_multirun_copy.py', [ "--subset", "5", "--dir_prob", "0.6","--ckpt_id", "fskag87u", "--experiment_name", "NTU_KD_Var3b-T_DSIT-S_FMS_DIR_sub5_fixh5"]),
# ('run_passt_KD_Cochl_TAU_FT_subsets_DIR_FMS_h5_multirun_copy.py', [ "--subset", "5", "--dir_prob", "0.6","--ckpt_id", "fskag87u", "--experiment_name", "NTU_KD_Var3b-T_DSIT-S_FMS_DIR_sub5_fixh5"]),
# ('run_passt_KD_Cochl_TAU_FT_subsets_DIR_FMS_h5_multirun_copy.py', [ "--subset", "5", "--dir_prob", "0.6","--ckpt_id", "fskag87u", "--experiment_name", "NTU_KD_Var3b-T_DSIT-S_FMS_DIR_sub5_fixh5"])
# ]
# run_multiple_scripts(scripts_to_run)