def path_setup(out_folder="", sublevel=0, data_path="dataset/"): #### Relative path data_path = os_package_root_path(__file__, sublevel=sublevel, path_add=data_path) out_path = os.getcwd() + "/" + out_folder os.makedirs(out_path, exist_ok=True) log(data_path, out_path) return data_path, out_path
def get_data_file(): return os.path.join(os_package_root_path(__file__), 'dataset', 'IMDB_Dataset.txt')
def get_config_file(): return os.path.join(os_package_root_path(__file__, 1), 'config', 'model_tch', 'textcnn.json')
def get_config_file(): return os.path.join(os_package_root_path(__file__, 1), 'config', 'model_keras', 'Imagecnn.json')
log("#### Save/Load ###################################################") save_pars = {"path": out_pars['path']} save(model, session=session, save_pars=save_pars) model2, session2 = load(save_pars) log("#### Save/Load - Predict #########################################") print(model2, session2) ypred = predict(model2, session2, data_pars, compute_pars, out_pars) if __name__ == '__main__': VERBOSE = True test_path = os.getcwd() + "/mytest/" root_path = os_package_root_path() ### Local fixed params # test(pars_choice="test01") #### Local json file test(pars_choice="json", data_path= f"dataset/json/refactor/charcnn.json") # #### test_module(model_uri="model_xxxx/yyyy.py", param_pars=None) # from mlmodels.models import test_module # # param_pars = {'choice': "json", 'config_mode': 'test', 'data_path': "model_keras/charcnn.json"} # test_module(model_uri=MODEL_URI, param_pars=param_pars) # # #### get of get_params
print(metrics_val) log("#### Plot ########################################################") log("#### Save/Load ###################################################") # save(model, session, save_pars=out_pars) # model2 = load(out_pars) # ypred = predict(model2, data_pars, compute_pars, out_pars) # metrics_val = metrics(model2, ypred, data_pars, compute_pars, out_pars) # print(model2) if __name__ == "__main__": VERBOSE = True test_path = os.getcwd() + "/mytest/" root_path = os_package_root_path(__file__, 0) ### Local fixed params # test(pars_choice="test01") ### Local json file # test(pars_choice="json", data_path=f"model_keras/namentity_crm_bilstm.json") #### test_module(model_uri="model_xxxx/yyyy.py", param_pars=None) from mlmodels.models import test_module param_pars = { "choice": "json", "config_mode": "test", "data_path": f"dataset/json/refactor/namentity_crm_bilstm_dataloader.json",