def get(self, request, graph_id): """ Manage AutoML define information include (id, desc and etc ) \n Structure : AutoML - NetID - NetVer(Auto Generated by GA) - NetBatch (auto generated on every batch) \n (1) Define AutoML Graph definition (<- for this step) \n (2) Select Type of Data (<- for this step)\n (3) Select Type of Anal algorithm (<- for this step)\n (4) Select range of hyper parameters (<- for this step)\n (5) Run - AutoML \n (6) Check result of each generation with UI/UX \n (7) Select Best model you want use and activate it \n --- # Class Name : RunManagerAutoRule # Description: Get AutoML description include hyperparameters for deep learning algorithms """ try: if graph_id.isdigit() == True : return_data = AutoMlRule().get_graph_type_list(graph_id) elif graph_id is not None : return_data = AutoMlRule().get_graph_info(graph_id) else : raise Exception("no vailed graph_id") return Response(json.dumps(return_data)) except Exception as e: return_data = {"status": "404", "result": str(e)} return Response(json.dumps(return_data))
def get(self, request, graph_id): """ - desc : get cnn configuration data """ try: if (graph_id == 'all'): return_data = AutoMlRule().get_graph_type_list() elif (graph_id is not None): return_data = AutoMlRule().get_graph_info(graph_id) else: raise Exception("no vailed graph_id") return Response(json.dumps(return_data)) except Exception as e: return_data = {"status": "404", "result": str(e)} return Response(json.dumps(return_data))
def put(self, request, graph_id): """ - desc ; update cnn configuration data """ try: return_data = AutoMlRule().update_graph_type_list( graph_id, request.data) return Response(json.dumps(return_data)) except Exception as e: return_data = {"status": "404", "result": str(e)} return Response(json.dumps(return_data))
def create_workflow(self, nn_id, wf_ver, type): """ create workflow base node info :param nn_id: :return: """ # crate state info with nn_id & workflow version input_data = {} input_data['nn_id'] = str(nn_id) input_data['nn_wf_ver_id'] = str(wf_ver) input_data['wf_state_id'] = str(nn_id) + "_" + str(wf_ver) state_id = self._create_workflow_state(input_data) #todo 나중에 꼭 지울것!!!!!!!! 임시방편 it is temporary solution if (type == 'frame'): type = 'wdnn' # create nodes fit to requested type (img, text, frame) net_node = AutoMlRule().get_graph_info(type, "all") self.set_node_name(net_node) if (type == 'cnn'): self._create_predefined_nodes_cnn(state_id) elif (type == 'resnet'): self._create_predefined_nodes_renet(state_id) elif (type == 'frame' or type == "wdnn" or type == "dnn"): self._create_predefined_nodes_frame(state_id) elif (type == 'keras_frame' or type == "wdnn_keras"): self._create_predefined_nodes_keras_frame(state_id) elif (type == 'word2vec'): self._create_predefined_nodes_word2vec(state_id) elif (type == 'word2vec_frame'): self._create_predefined_nodes_word2vec_frame(state_id) elif (type == 'doc2vec'): self._create_predefined_nodes_doc2vec(state_id) elif (type == 'wcnn'): self._create_predefined_nodes_wcnn_frame(state_id) elif (type == 'seq2seq'): self._create_predefined_nodes_seq2seq(state_id) elif (type == 'seq2seq_csv'): self._create_predefined_nodes_seq2seq_csv(state_id) elif (type == 'autoencoder_img'): self._create_predefined_nodes_autoencoder_img(state_id) elif (type == 'autoencoder_csv'): self._create_predefined_nodes_autoencoder_csv(state_id) elif (type == 'bilstmcrf_iob'): self._create_predefined_nodes_bilstmcrf_iob(state_id) elif (type == 'fasttext_txt'): self._create_predefined_nodes_fasttext_txt(state_id) else: raise Exception("Error : Not defined type (" + type + ")") return type
def get(self, request, graph_id): """ Your docs --- # Class Name (must be separated by `---`) # Description: - name: name description: Foobar long description goes here """ try: if (graph_id == 'all'): return_data = AutoMlRule().get_graph_type_list() elif (graph_id is not None): return_data = AutoMlRule().get_graph_info(graph_id) else: raise Exception("no vailed graph_id") return Response(json.dumps(return_data)) except Exception as e: return_data = {"status": "404", "result": str(e)} return Response(json.dumps(return_data))
def get_nn_node_name(self, nn_id): """ search all node name info :param nn_id: neural network definition id :return: sql """ try : condition = {} condition['nn_id'] = nn_id nninfo = NNCommonManager().get_nn_info(condition) type = nninfo[0]['dir'] net_node = AutoMlRule().get_graph_info(type, "all") graph_id = net_node[0]['fields']["graph_flow_info_id"] graph = WorkFlowStateMenu().get_graph_info(graph_id) return graph except Exception as e : return []
def put(self, request, graph_id): """ Your docs --- # Class Name (must be separated by `---`) # Description: - name: name description: Foobar long description goes here """ try: return_data = AutoMlRule().update_graph_type_list( graph_id, request.data) return Response(json.dumps(return_data)) except Exception as e: return_data = {"status": "404", "result": str(e)} return Response(json.dumps(return_data))
def post(self, request, graph_id): """ Manage AutoML define information include (id, desc and etc ) \n Structure : AutoML - NetID - NetVer(Auto Generated by GA) - NetBatch (auto generated on every batch) \n (1) Define AutoML Graph definition (<- for this step) \n (2) Select Type of Data (<- for this step)\n (3) Select Type of Anal algorithm (<- for this step)\n (4) Select range of hyper parameters (<- for this step)\n (5) Run - AutoML \n (6) Check result of each generation with UI/UX \n (7) Select Best model you want use and activate it \n --- # Class Name : RunManagerAutoRule # Description: Set AutoML description, This is necessary process if you want to use automatically tune hyperparameters for deep learning algorithms """ try: return_data = AutoMlRule().set_graph_type_list(graph_id, request.data) return Response(json.dumps(return_data)) except Exception as e: return_data = {"status": "404", "result": str(e)} return Response(json.dumps(return_data))
def get(self, request, nnid, ver, dir, type=None): """ File Management Rest Service --- # Class Name : FileUploadView # Description: Get file counts or file name of given network id and version """ if (type != None): # tmp 임시 저장소의 값을 만들어서 전달해줌. if type.find("tmp") >= 0: tmpfilepath = get_source_path(nnid, ver, "") if type != None and type.find("store") >= 0: tmpfilepath = get_store_path(nnid, ver, "") fileName = time.strftime('%Y%m%d') stand = "1".zfill(10) stcnt = int(fileName + stand) mxcnt = stcnt for i in os.listdir(tmpfilepath): try: if int(i) >= mxcnt: mxcnt = int(i) + 1 if int(i) < stcnt: shutil.rmtree(tmpfilepath + i) except: None mxcnt = str(mxcnt) if not os.path.isdir(tmpfilepath + mxcnt): os.mkdir(tmpfilepath + mxcnt) return_data = {"path": mxcnt} elif type.find("runcheck") >= 0: return_data = [] graph = NNCommonManager().get_nn_node_name(nnid) for net in graph: if net['fields']['graph_node'] == 'netconf_data': netconf_data = net['fields']['graph_node_name'] if net['fields']['graph_node'] == 'eval_data': eval_data = net['fields']['graph_node_name'] source_path_n = get_source_path(nnid, ver, netconf_data) source_path_e = get_source_path(nnid, ver, eval_data) store_path_n = get_store_path(nnid, ver, netconf_data) store_path_e = get_store_path(nnid, ver, eval_data) source_n_cnt = len(os.listdir(source_path_n)) source_e_cnt = len(os.listdir(source_path_e)) store_n_cnt = len(os.listdir(store_path_n)) store_e_cnt = len(os.listdir(store_path_e)) condition = {} condition['nn_id'] = nnid dir = NNCommonManager().get_nn_info(condition)[0]['dir'] auto = AutoMlRule().get_graph_info(dir) if auto[0]['fields'][ 'train_file_path'] != '' and source_n_cnt == 0 and store_n_cnt == 0: resub = {"filecnt": 0, "type": "Source"} elif auto[0]['fields'][ 'eval_file_path'] != '' and source_e_cnt == 0 and store_e_cnt == 0: resub = {"filecnt": 0, "type": "Eval"} else: resub = {"filecnt": 1} return_data.append(resub) else: return_data = [] tmpfilepath = get_source_path(nnid, ver, dir) if type != None and type.find("store") >= 0: tmpfilepath = get_store_path(nnid, ver, dir) for i in os.listdir(tmpfilepath): resub = {"filename": i} return_data.append(resub) else: return_data = WorkFlowDataImage().get_data_node_info( nnid, ver, dir) return Response(json.dumps(return_data))