1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import sys
- import os
- import json
- # from lemon_master.mutation_executor import lemon_process
- from lemon_master.run.mutation_executor import lemon_process
- def mock(exp: str, root_dir: str, output_dir: str, mutate_num: int, config_name: str):
- print("running")
- print("exp:", exp)
- print("root_dir:", root_dir)
- print("out_dir:", output_dir)
- print("mutate_num:", mutate_num)
- print("config_name:", config_name)
- data = [
- {
- "model": "lenet5-fashion-mnist",
- "method": "origin0",
- "result": {
- "Losses": 0.3032414233312011,
- "Accuracy": 0.9062593914568424,
- "MemoryInfoList": 1.2329671382904053,
- },
- }
- ]
- return data
- result_num = 0
- def runtool(
- exp: str, mutate_num: int
- ):
- global result_num
- config_name = "demo.conf"
- base_dir = os.path.dirname(os.path.abspath(__file__))
- print(base_dir)
-
- result_num = ( result_num + 1 ) % 5
-
- output_dir = os.path.join(base_dir, "output", str(result_num))
-
- if os.path.exists(output_dir):
- print("remove output_dir:", output_dir)
- # TODO: 正式时需要删除 os.system("rm -rf " + output_dir)
-
- print("running")
- print("exp:", exp)
- print("out_dir:", output_dir)
- print("mutate_num:", mutate_num)
- print("config_name:", config_name)
- root_dir = os.path.join(base_dir, "lemon_master")
-
- target_dir = os.path.join(base_dir, "lemon_master", "run")
- print(target_dir)
- sys.path.append(target_dir)
-
- # TODO: 正式时需要注释lemon_process(exp, root_dir, output_dir, mutate_num, config_name)
-
- real_output_dir = os.path.join(output_dir, exp)
-
- mxnet_json = os.path.join(real_output_dir, "mxnet.json")
- with open(
- mxnet_json, "r"
- ) as file1: # tensorflow.json
- data1 = json.load(file1)
-
- tensorflow_json = os.path.join(real_output_dir, "tensorflow.json")
- with open(tensorflow_json, "r") as file2:
- data2 = json.load(file2)
-
- combined_data = {
- "mxnet": data1,
- "tensorflow": data2
- }
- return combined_data
|