Spaces:
Runtime error
Runtime error
Yixin Liu
commited on
Commit
·
13a42e4
1
Parent(s):
5f30d29
update
Browse files
main.py
CHANGED
|
@@ -50,7 +50,7 @@ if exp_mode == "OneExpOnecard":
|
|
| 50 |
allow_gpu_memory_threshold_default = 20000
|
| 51 |
gpu_threshold_default = 1
|
| 52 |
elif exp_mode == "MultipleExpOnecard":
|
| 53 |
-
allow_gpu_memory_threshold_default =
|
| 54 |
gpu_threshold_default = 70
|
| 55 |
allow_gpu_memory_threshold = st.number_input("最小单卡剩余容量", value=allow_gpu_memory_threshold_default, min_value=0, max_value=30000, step=1000)
|
| 56 |
gpu_threshold = st.number_input("最大单卡利用率", value=gpu_threshold_default, min_value=0, max_value=100, step=10)
|
|
@@ -58,12 +58,12 @@ sleep_time_after_loading_task= st.number_input("加载任务后等待秒数", va
|
|
| 58 |
all_full_sleep_time = st.number_input("全满之后等待秒数", value=20, min_value=0,step=5)
|
| 59 |
|
| 60 |
gpu_list_str = ' '.join([str(i) for i in gpu_list])
|
| 61 |
-
gpu_hyper = "gpu
|
| 62 |
gpu_hyper+=f"allow_gpu_memory_threshold={allow_gpu_memory_threshold}\n"
|
| 63 |
gpu_hyper+=f"gpu_threshold={gpu_threshold}\n"
|
| 64 |
gpu_hyper+=f"sleep_time_after_loading_task={sleep_time_after_loading_task}s\n"
|
| 65 |
gpu_hyper+=f"all_full_sleep_time={all_full_sleep_time}s\n"
|
| 66 |
-
gpu_hyper+=
|
| 67 |
gpu_hyper+="i=0\n"
|
| 68 |
|
| 69 |
main_loop = st.text_area("Main loop", """for lambda_1 in 1 3;do
|
|
@@ -77,15 +77,19 @@ main_loop = st.text_area("Main loop", """for lambda_1 in 1 3;do
|
|
| 77 |
--K $K --seed $seed --train_mode adv_train --bsize $bsize --n_epoch $n_epoch --lr $lr \
|
| 78 |
--eval_baseline
|
| 79 |
done;done;done;done;done;""")
|
| 80 |
-
|
| 81 |
-
hyper_loop = main_loop.split("python")[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
print(hyper_loop)
|
| 83 |
-
python_cmd = main_loop.split(";do\n")[-1].split('done;')[0]
|
| 84 |
print(python_cmd)
|
| 85 |
-
end_loop = "done;"*hyper_loop.count("
|
| 86 |
print(end_loop)
|
| 87 |
|
| 88 |
|
|
|
|
| 89 |
g = st.button("Generate")
|
| 90 |
if g:
|
| 91 |
s = ""
|
|
|
|
| 50 |
allow_gpu_memory_threshold_default = 20000
|
| 51 |
gpu_threshold_default = 1
|
| 52 |
elif exp_mode == "MultipleExpOnecard":
|
| 53 |
+
allow_gpu_memory_threshold_default = 3000
|
| 54 |
gpu_threshold_default = 70
|
| 55 |
allow_gpu_memory_threshold = st.number_input("最小单卡剩余容量", value=allow_gpu_memory_threshold_default, min_value=0, max_value=30000, step=1000)
|
| 56 |
gpu_threshold = st.number_input("最大单卡利用率", value=gpu_threshold_default, min_value=0, max_value=100, step=10)
|
|
|
|
| 58 |
all_full_sleep_time = st.number_input("全满之后等待秒数", value=20, min_value=0,step=5)
|
| 59 |
|
| 60 |
gpu_list_str = ' '.join([str(i) for i in gpu_list])
|
| 61 |
+
gpu_hyper = f"gpu=({gpu_list_str})\n"
|
| 62 |
gpu_hyper+=f"allow_gpu_memory_threshold={allow_gpu_memory_threshold}\n"
|
| 63 |
gpu_hyper+=f"gpu_threshold={gpu_threshold}\n"
|
| 64 |
gpu_hyper+=f"sleep_time_after_loading_task={sleep_time_after_loading_task}s\n"
|
| 65 |
gpu_hyper+=f"all_full_sleep_time={all_full_sleep_time}s\n"
|
| 66 |
+
gpu_hyper+="gpunum=${#gpu[@]}\n"
|
| 67 |
gpu_hyper+="i=0\n"
|
| 68 |
|
| 69 |
main_loop = st.text_area("Main loop", """for lambda_1 in 1 3;do
|
|
|
|
| 77 |
--K $K --seed $seed --train_mode adv_train --bsize $bsize --n_epoch $n_epoch --lr $lr \
|
| 78 |
--eval_baseline
|
| 79 |
done;done;done;done;done;""")
|
| 80 |
+
if 'python' in main_loop:
|
| 81 |
+
hyper_loop = main_loop.split("python")[0]
|
| 82 |
+
python_cmd = main_loop[main_loop.index('python'):].split('done;')[0]
|
| 83 |
+
elif 'bash' in main_loop:
|
| 84 |
+
hyper_loop = main_loop.split("bash")[0]
|
| 85 |
+
python_cmd = main_loop[main_loop.index('bash'):].split('done;')[0]
|
| 86 |
print(hyper_loop)
|
|
|
|
| 87 |
print(python_cmd)
|
| 88 |
+
end_loop = "done;"*hyper_loop.count("for")
|
| 89 |
print(end_loop)
|
| 90 |
|
| 91 |
|
| 92 |
+
|
| 93 |
g = st.button("Generate")
|
| 94 |
if g:
|
| 95 |
s = ""
|