提交 047ec1ae 编写于 作者: W weisy11

use list instead of dict

上级 87a0ba6f
......@@ -4,24 +4,24 @@ distill_config_file: ppcls/configs/cls_demo/person/Distillation/PPLCNet_x1_0_dis
gpus: 0,1,2,3
output_dir: output/search_person
search_dict:
lrs:
- search_key: lrs
replace_config:
- Optimizer.lr.learning_rate
search_values: [0.0075, 0.01, 0.0125]
resolutions:
- search_key: resolutions
replace_config:
- DataLoader.Train.dataset.transform_ops.1.RandCropImage.size
- DataLoader.Train.dataset.transform_ops.3.TimmAutoAugment.img_size
search_values: [176, 192, 224]
ra_probs:
- search_key: ra_probs
replace_config:
- DataLoader.Train.dataset.transform_ops.3.TimmAutoAugment.prob
search_values: [0.0, 0.1, 0.5]
re_probs:
- search_key: re_probs
replace_config:
- DataLoader.Train.dataset.transform_ops.5.RandomErasing.EPSILON
search_values: [0.0, 0.1, 0.5]
lr_mult_list:
- search_key: lr_mult_list
replace_config:
- Arch.lr_mult_list
search_values:
......
......@@ -54,9 +54,10 @@ def search_strategy():
base_output_dir = configs["output_dir"]
search_dict = configs.get("search_dict")
all_results = {}
for search_key in search_dict:
search_values = search_dict[search_key]["search_values"]
replace_config = search_dict[search_key]["replace_config"]
for search_i in search_dict:
search_key = search_i["search_key"]
search_values = search_i["search_values"]
replace_config = search_i["replace_config"]
res = search_train(search_values, base_program, base_output_dir, search_key, replace_config, model_name)
all_results[search_key] = res
best = res.get("best")
......@@ -73,7 +74,6 @@ def search_strategy():
for ind, ki in enumerate(base_program):
if rm_k in ki:
rm_indices.append(ind)
print(rm_indices)
for rm_index in rm_indices[::-1]:
teacher_program.pop(rm_index)
teacher_program.pop(rm_index-1)
......@@ -94,9 +94,9 @@ def search_strategy():
v = final_replace[k]
base_program[i] = base_program[i].replace(k, v)
print(all_results, base_program)
process = subprocess.Popen(base_program)
process.communicate()
print(all_results, base_program)
if __name__ == '__main__':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册