Преглед на файлове

调整参数,可直接运行后端进行测试接口。待最后一步docker调整

root преди 5 месеца
родител
ревизия
215e1878de
променени са 31 файла, в които са добавени 256 реда и са изтрити 22 реда
  1. 1 4
      server/app.py
  2. 2 3
      server/config.yml
  3. 2 2
      server/lemon_master/run/mutation_executor.py
  4. BIN
      server/output/1/fashion2/crash/fashion2_origin0-MLA1.hdf5
  5. BIN
      server/output/1/fashion2/crash/fashion2_origin0.hdf5
  6. BIN
      server/output/1/fashion2/fashion2_lemon_results.pkl
  7. BIN
      server/output/1/fashion2/inner_output/prediction_fashion2_origin0-ARep1.h.pkl
  8. BIN
      server/output/1/fashion2/inner_output/prediction_fashion2_origin0-ARep2.h.pkl
  9. BIN
      server/output/1/fashion2/inner_output/prediction_fashion2_origin0-LR1-LA1.h.pkl
  10. BIN
      server/output/1/fashion2/inner_output/prediction_fashion2_origin0-LR1.h.pkl
  11. BIN
      server/output/1/fashion2/inner_output/prediction_fashion2_origin0-NEB1.h.pkl
  12. BIN
      server/output/1/fashion2/inner_output/prediction_fashion2_origin0.h.pkl
  13. 61 0
      server/output/1/fashion2/metrics_result/fashion2_D_MAD_result.csv
  14. BIN
      server/output/1/fashion2/mut_model/fashion2_origin0-ARep1.hdf5
  15. BIN
      server/output/1/fashion2/mut_model/fashion2_origin0-ARep1.hdf5res.npy
  16. BIN
      server/output/1/fashion2/mut_model/fashion2_origin0-ARep2.hdf5
  17. BIN
      server/output/1/fashion2/mut_model/fashion2_origin0-ARep2.hdf5res.npy
  18. BIN
      server/output/1/fashion2/mut_model/fashion2_origin0-LR1-LA1.hdf5
  19. BIN
      server/output/1/fashion2/mut_model/fashion2_origin0-LR1-LA1.hdf5res.npy
  20. BIN
      server/output/1/fashion2/mut_model/fashion2_origin0-LR1.hdf5
  21. BIN
      server/output/1/fashion2/mut_model/fashion2_origin0-LR1.hdf5res.npy
  22. BIN
      server/output/1/fashion2/mut_model/fashion2_origin0-MLA1.hdf5res.npy
  23. BIN
      server/output/1/fashion2/mut_model/fashion2_origin0-NEB1.hdf5
  24. BIN
      server/output/1/fashion2/mut_model/fashion2_origin0-NEB1.hdf5res.npy
  25. BIN
      server/output/1/fashion2/mut_model/fashion2_origin0.hdf5
  26. BIN
      server/output/1/fashion2/mut_model/fashion2_origin0.hdf5res.npy
  27. 5 0
      server/output/1/fashion2/mutant_history.txt
  28. 13 0
      server/output/1/fashion2/mutator_history.csv
  29. 74 0
      server/output/1/fashion2/mxnet.json
  30. 65 0
      server/output/1/fashion2/tensorflow.json
  31. 33 13
      server/tool.py

+ 1 - 4
server/app.py

@@ -29,10 +29,7 @@ def run():
     data = request.get_json()
     exp = data['exp']
     mutate_num = data['mutate_num']
-    root_dir = app.config['root_dir']
-    output_dir = app.config['output_dir']
-    config_name = app.config['config_name']
-    data = runtool(exp, root_dir, output_dir, config_name, mutate_num)
+    data = runtool(exp, mutate_num)
 
     print(data)
     return data

+ 2 - 3
server/config.yml

@@ -1,4 +1,3 @@
 default:
-  root_dir: server/LEMON-master
-  output_dir: server/LEMON-master/lemon_outputs
-  config_name: server/LEMON-master/config/demo.conf
+  output_dir: server/lemon_master/lemon_outputs
+  config_name: demo.conf

+ 2 - 2
server/lemon_master/run/mutation_executor.py

@@ -4,7 +4,7 @@ import sys
 import os
 
 sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-sys.path.append("../")
+# sys.path.append("../")
 from scripts.logger.lemon_logger import Logger
 import warnings
 import datetime
@@ -23,6 +23,7 @@ os.environ["CUDA_VISIBLE_DEVICES"] = ""
 def lemon_process(exp, root_dir, output_dir, mutate_num, config_name):
     lemon_cfg = configparser.ConfigParser()
     cfg_path = os.path.join(root_dir, "config", config_name)
+    print(cfg_path)
     lemon_cfg.read(cfg_path)
     parameters = lemon_cfg["parameters"]
     flags = argparse.Namespace(
@@ -111,7 +112,6 @@ def lemon_process(exp, root_dir, output_dir, mutate_num, config_name):
         "INFO:Lemon is done: Time used: {} hour,{} min,{} sec".format(h, m, s)
     )
 
-
 if __name__ == "__main__":
 
     # config_name = sys.argv[1]

BIN
server/output/1/fashion2/crash/fashion2_origin0-MLA1.hdf5


BIN
server/output/1/fashion2/crash/fashion2_origin0.hdf5


BIN
server/output/1/fashion2/fashion2_lemon_results.pkl


BIN
server/output/1/fashion2/inner_output/prediction_fashion2_origin0-ARep1.h.pkl


BIN
server/output/1/fashion2/inner_output/prediction_fashion2_origin0-ARep2.h.pkl


BIN
server/output/1/fashion2/inner_output/prediction_fashion2_origin0-LR1-LA1.h.pkl


BIN
server/output/1/fashion2/inner_output/prediction_fashion2_origin0-LR1.h.pkl


BIN
server/output/1/fashion2/inner_output/prediction_fashion2_origin0-NEB1.h.pkl


BIN
server/output/1/fashion2/inner_output/prediction_fashion2_origin0.h.pkl


+ 61 - 0
server/output/1/fashion2/metrics_result/fashion2_D_MAD_result.csv

@@ -0,0 +1,61 @@
+Mutation-Backend-Pair,Inconsistency Score
+fashion2_origin0.h_tensorflow_mxnet_input0,2.789349491649773e-05
+fashion2_origin0.h_tensorflow_mxnet_input1,2.0714646780106705e-06
+fashion2_origin0.h_tensorflow_mxnet_input2,1.3693011169380043e-06
+fashion2_origin0.h_tensorflow_mxnet_input3,3.507439600980433e-07
+fashion2_origin0.h_tensorflow_mxnet_input4,7.013139224909537e-07
+fashion2_origin0.h_tensorflow_mxnet_input5,0.0011009954614564776
+fashion2_origin0.h_tensorflow_mxnet_input6,1.8905183196693542e-06
+fashion2_origin0.h_tensorflow_mxnet_input7,8.76466219779104e-06
+fashion2_origin0.h_tensorflow_mxnet_input8,3.5046812172367936e-06
+fashion2_origin0.h_tensorflow_mxnet_input9,6.812222181906691e-07
+fashion2_origin0-NEB1.h_tensorflow_mxnet_input0,9.716324029795942e-07
+fashion2_origin0-NEB1.h_tensorflow_mxnet_input1,5.416876774688717e-06
+fashion2_origin0-NEB1.h_tensorflow_mxnet_input2,5.91980351600796e-05
+fashion2_origin0-NEB1.h_tensorflow_mxnet_input3,4.409097982716048e-06
+fashion2_origin0-NEB1.h_tensorflow_mxnet_input4,6.377923256195572e-08
+fashion2_origin0-NEB1.h_tensorflow_mxnet_input5,3.4024094475171296e-07
+fashion2_origin0-NEB1.h_tensorflow_mxnet_input6,7.300808420040994e-07
+fashion2_origin0-NEB1.h_tensorflow_mxnet_input7,6.610469540646591e-07
+fashion2_origin0-NEB1.h_tensorflow_mxnet_input8,5.993259151182428e-07
+fashion2_origin0-NEB1.h_tensorflow_mxnet_input9,1.1328842930424798e-07
+fashion2_origin0-ARep1.h_tensorflow_mxnet_input0,2.789349491649773e-05
+fashion2_origin0-ARep1.h_tensorflow_mxnet_input1,2.0714646780106705e-06
+fashion2_origin0-ARep1.h_tensorflow_mxnet_input2,1.3693011169380043e-06
+fashion2_origin0-ARep1.h_tensorflow_mxnet_input3,3.507439600980433e-07
+fashion2_origin0-ARep1.h_tensorflow_mxnet_input4,7.013139224909537e-07
+fashion2_origin0-ARep1.h_tensorflow_mxnet_input5,0.0011009954614564776
+fashion2_origin0-ARep1.h_tensorflow_mxnet_input6,1.8905183196693542e-06
+fashion2_origin0-ARep1.h_tensorflow_mxnet_input7,8.76466219779104e-06
+fashion2_origin0-ARep1.h_tensorflow_mxnet_input8,3.5046812172367936e-06
+fashion2_origin0-ARep1.h_tensorflow_mxnet_input9,6.812222181906691e-07
+fashion2_origin0-ARep2.h_tensorflow_mxnet_input0,2.789349491649773e-05
+fashion2_origin0-ARep2.h_tensorflow_mxnet_input1,2.0714646780106705e-06
+fashion2_origin0-ARep2.h_tensorflow_mxnet_input2,1.3693011169380043e-06
+fashion2_origin0-ARep2.h_tensorflow_mxnet_input3,3.507439600980433e-07
+fashion2_origin0-ARep2.h_tensorflow_mxnet_input4,7.013139224909537e-07
+fashion2_origin0-ARep2.h_tensorflow_mxnet_input5,0.0011009954614564776
+fashion2_origin0-ARep2.h_tensorflow_mxnet_input6,1.8905183196693542e-06
+fashion2_origin0-ARep2.h_tensorflow_mxnet_input7,8.76466219779104e-06
+fashion2_origin0-ARep2.h_tensorflow_mxnet_input8,3.5046812172367936e-06
+fashion2_origin0-ARep2.h_tensorflow_mxnet_input9,6.812222181906691e-07
+fashion2_origin0-LR1.h_tensorflow_mxnet_input0,2.1494726354376326e-07
+fashion2_origin0-LR1.h_tensorflow_mxnet_input1,1.0246135389024857e-06
+fashion2_origin0-LR1.h_tensorflow_mxnet_input2,5.563522790907882e-06
+fashion2_origin0-LR1.h_tensorflow_mxnet_input3,2.2931722298835666e-07
+fashion2_origin0-LR1.h_tensorflow_mxnet_input4,6.707047646159481e-07
+fashion2_origin0-LR1.h_tensorflow_mxnet_input5,0.0020074336789548397
+fashion2_origin0-LR1.h_tensorflow_mxnet_input6,2.3664529180678073e-06
+fashion2_origin0-LR1.h_tensorflow_mxnet_input7,2.4270579501717293e-07
+fashion2_origin0-LR1.h_tensorflow_mxnet_input8,6.093952470109798e-05
+fashion2_origin0-LR1.h_tensorflow_mxnet_input9,1.2965877260739944e-07
+fashion2_origin0-LR1-LA1.h_tensorflow_mxnet_input0,4.190492575162352e-08
+fashion2_origin0-LR1-LA1.h_tensorflow_mxnet_input1,0.0
+fashion2_origin0-LR1-LA1.h_tensorflow_mxnet_input2,0.0
+fashion2_origin0-LR1-LA1.h_tensorflow_mxnet_input3,0.0
+fashion2_origin0-LR1-LA1.h_tensorflow_mxnet_input4,0.0
+fashion2_origin0-LR1-LA1.h_tensorflow_mxnet_input5,0.0
+fashion2_origin0-LR1-LA1.h_tensorflow_mxnet_input6,0.0
+fashion2_origin0-LR1-LA1.h_tensorflow_mxnet_input7,0.0
+fashion2_origin0-LR1-LA1.h_tensorflow_mxnet_input8,0.0
+fashion2_origin0-LR1-LA1.h_tensorflow_mxnet_input9,0.0

BIN
server/output/1/fashion2/mut_model/fashion2_origin0-ARep1.hdf5


BIN
server/output/1/fashion2/mut_model/fashion2_origin0-ARep1.hdf5res.npy


BIN
server/output/1/fashion2/mut_model/fashion2_origin0-ARep2.hdf5


BIN
server/output/1/fashion2/mut_model/fashion2_origin0-ARep2.hdf5res.npy


BIN
server/output/1/fashion2/mut_model/fashion2_origin0-LR1-LA1.hdf5


BIN
server/output/1/fashion2/mut_model/fashion2_origin0-LR1-LA1.hdf5res.npy


BIN
server/output/1/fashion2/mut_model/fashion2_origin0-LR1.hdf5


BIN
server/output/1/fashion2/mut_model/fashion2_origin0-LR1.hdf5res.npy


BIN
server/output/1/fashion2/mut_model/fashion2_origin0-MLA1.hdf5res.npy


BIN
server/output/1/fashion2/mut_model/fashion2_origin0-NEB1.hdf5


BIN
server/output/1/fashion2/mut_model/fashion2_origin0-NEB1.hdf5res.npy


BIN
server/output/1/fashion2/mut_model/fashion2_origin0.hdf5


BIN
server/output/1/fashion2/mut_model/fashion2_origin0.hdf5res.npy


+ 5 - 0
server/output/1/fashion2/mutant_history.txt

@@ -0,0 +1,5 @@
+fashion2_origin0-NEB1.hdf5
+fashion2_origin0-ARep1.hdf5
+fashion2_origin0-ARep2.hdf5
+fashion2_origin0-LR1.hdf5
+fashion2_origin0-LR1-LA1.hdf5

+ 13 - 0
server/output/1/fashion2/mutator_history.csv

@@ -0,0 +1,13 @@
+Name,Success,Invalid,Total
+WS,0,0,0
+GF,0,0,0
+NEB,0,0,1
+NAI,0,0,0
+NS,0,0,0
+ARem,0,0,0
+ARep,0,0,2
+LA,0,0,1
+LC,0,0,0
+LR,1,0,1
+LS,0,0,0
+MLA,0,0,1

+ 74 - 0
server/output/1/fashion2/mxnet.json

@@ -0,0 +1,74 @@
+[
+    {
+        "model": "fashion2",
+        "method": "origin0",
+        "result": {
+            "Losses": 0.277938068844378,
+            "Accuracy": 0.9009915851056576,
+            "MemoryInfoList": 0.4459855556488037
+        }
+    },
+    {
+        "model": "fashion2",
+        "method": "origin0",
+        "result": {
+            "Losses": 0.2785839820280671,
+            "Accuracy": 0.901329904794693,
+            "MemoryInfoList": 0.7526042461395264
+        }
+    },
+    {
+        "model": "fashion2",
+        "method": "origin0",
+        "result": {
+            "Losses": 0.2735654469579458,
+            "Accuracy": 0.9050339907407761,
+            "MemoryInfoList": 0.8557529449462891
+        }
+    },
+    {
+        "model": "fashion2",
+        "method": "origin0-NEB1",
+        "result": {
+            "Losses": 0.3057802524417639,
+            "Accuracy": 0.89111328125,
+            "MemoryInfoList": 0.8596644401550293
+        }
+    },
+    {
+        "model": "fashion2",
+        "method": "origin0-ARep1",
+        "result": {
+            "Losses": 0.2746584555134177,
+            "Accuracy": 0.9045175388455391,
+            "MemoryInfoList": 0.8402256965637207
+        }
+    },
+    {
+        "model": "fashion2",
+        "method": "origin0-ARep2",
+        "result": {
+            "Losses": 0.27433568704873323,
+            "Accuracy": 0.9029400162398815,
+            "MemoryInfoList": 0.8651509284973145
+        }
+    },
+    {
+        "model": "fashion2",
+        "method": "origin0-LR1",
+        "result": {
+            "Losses": 0.3905642945319414,
+            "Accuracy": 0.8800189681351185,
+            "MemoryInfoList": 0.8215579986572266
+        }
+    },
+    {
+        "model": "fashion2",
+        "method": "origin0-LR1-LA1",
+        "result": {
+            "Losses": 1.9164182916283607,
+            "Accuracy": 0.509122408926487,
+            "MemoryInfoList": 0.8505094051361084
+        }
+    }
+]

+ 65 - 0
server/output/1/fashion2/tensorflow.json

@@ -0,0 +1,65 @@
+[
+    {
+        "model": "fashion2",
+        "method": "origin0",
+        "result": {
+            "Losses": 0.2787128910422325,
+            "Accuracy": 0.9072865433990955,
+            "MemoryInfoList": 0.8984525203704834
+        }
+    },
+    {
+        "model": "fashion2",
+        "method": "origin0",
+        "result": {
+            "Losses": 0.27523318585008383,
+            "Accuracy": 0.9036630503833294,
+            "MemoryInfoList": 0.763070821762085
+        }
+    },
+    {
+        "model": "fashion2",
+        "method": "origin0-NEB1",
+        "result": {
+            "Losses": 0.30588953476399183,
+            "Accuracy": 0.8904231153428555,
+            "MemoryInfoList": 0.7484502792358398
+        }
+    },
+    {
+        "model": "fashion2",
+        "method": "origin0-ARep1",
+        "result": {
+            "Losses": 0.2769636195152998,
+            "Accuracy": 0.9029916599392891,
+            "MemoryInfoList": 0.7493219375610352
+        }
+    },
+    {
+        "model": "fashion2",
+        "method": "origin0-ARep2",
+        "result": {
+            "Losses": 0.276142087765038,
+            "Accuracy": 0.9037710353732109,
+            "MemoryInfoList": 0.7656466960906982
+        }
+    },
+    {
+        "model": "fashion2",
+        "method": "origin0-LR1",
+        "result": {
+            "Losses": 0.3914049342274666,
+            "Accuracy": 0.8786574117839336,
+            "MemoryInfoList": 0.7475287914276123
+        }
+    },
+    {
+        "model": "fashion2",
+        "method": "origin0-LR1-LA1",
+        "result": {
+            "Losses": 1.9165625423192978,
+            "Accuracy": 0.5086904689669609,
+            "MemoryInfoList": 0.8675270080566406
+        }
+    }
+]

+ 33 - 13
server/tool.py

@@ -27,31 +27,51 @@ def mock(exp: str, root_dir: str, output_dir: str, mutate_num: int, config_name:
     return data
 
 
+result_num = 0
 def runtool(
-    exp: str, root_dir: str, output_dir: str, mutate_num: int, config_name: str
+    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("root_dir:", root_dir)
     print("out_dir:", output_dir)
     print("mutate_num:", mutate_num)
     print("config_name:", config_name)
 
-    base_dir = os.path.dirname(
-        os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-    )
-    print(base_dir)
-    target_dir = os.path.join(base_dir, "server", "LEMON-master", "run")
+    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)
-
-    lemon_process(exp, root_dir, output_dir, mutate_num, config_name)
-    # TODO:设置为真实的文件路径
+    
+    # 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(
-        "server/LEMON-master/lemon_outputs/mxnet.json", "r"
+        mxnet_json, "r"
     ) as file1:  # tensorflow.json
         data1 = json.load(file1)
-    with open("server/LEMON-master/lemon_outputs/tensorflow.json", "r") as file2:
+    
+    tensorflow_json = os.path.join(real_output_dir, "tensorflow.json")
+    with open(tensorflow_json, "r") as file2:
         data2 = json.load(file2)
-    combined_data = [data1, data2]
+        
+    combined_data = {
+        "mxnet": data1,
+        "tensorflow": data2
+    }
     return combined_data