Fixing bugs and adding new features

This commit is contained in:
araison 2022-12-27 17:54:59 +01:00
parent e1b2a64bd6
commit 7c4f5ca196
8 changed files with 294 additions and 121 deletions

View file

@ -66,17 +66,18 @@ set_eixgnn_cfg(eixgnn_cfg)
# eixgnn_cfg.dump(stream=f)
#
#
# def load_eixgnn_cfg(eixgnn_cfg, args):
# r"""
# Load configurations from file system and command line
# Args:
# eixgnn_cfg (CfgNode): Configuration node
# args (ArgumentParser): Command argument parser
# """
# eixgnn_cfg.merge_from_file(args.eixgnn_cfg_file)
# eixgnn_cfg.merge_from_list(args.opts)
# assert_eixgnn_cfg(eixgnn_cfg)
#
def load_eixgnn_cfg(eixgnn_cfg, args):
r"""
Load configurations from file system and command line
Args:
eixgnn_cfg (CfgNode): Configuration node
args (ArgumentParser): Command argument parser
"""
eixgnn_cfg.merge_from_file(args.eixgnn_cfg_file)
eixgnn_cfg.merge_from_list(args.opts)
assert_eixgnn_cfg(eixgnn_cfg)
#
# def makedirs_rm_exist(dir):
# if os.path.isdir(dir):

View file

@ -36,27 +36,25 @@ def set_scgnn_cfg(scgnn_cfg):
if scgnn_cfg is None:
return scgnn_cfg
scgnn_cfg.depth = 'all'
scgnn_cfg.depth = "all"
scgnn_cfg.interest_map_norm = True
scgnn_cfg.score_map_norm = True
def assert_scgnn_cfg(scgnn_cfg):
def assert_cfg(scgnn_cfg):
r"""Checks config values, do necessary post processing to the configs
TODO
TODO
"""
if scgnn_cfg. not in ["node", "edge", "graph", "link_pred"]:
raise ValueError(
"Task {} not supported, must be one of node, "
"edge, graph, link_pred".format(scgnn_cfg.dataset.task)
)
scgnn_cfg.run_dir = scgnn_cfg.out_dir
"""
# if scgnn_cfg. not in ["node", "edge", "graph", "link_pred"]:
# raise ValueError(
# "Task {} not supported, must be one of node, "
# "edge, graph, link_pred".format(scgnn_cfg.dataset.task)
# )
# scgnn_cfg.run_dir = scgnn_cfg.out_dir
def dump_scgnn_cfg(scgnn_cfg,path):
def dump_cfg(scgnn_cfg, path):
r"""
TODO
Dumps the config to the output directory specified in
@ -65,14 +63,12 @@ def dump_scgnn_cfg(scgnn_cfg,path):
scgnn_cfg (CfgNode): Configuration node
"""
makedirs(scgnn_cfg.out_dir)
scgnn_cfg_file = os.path.join(
scgnn_cfg.out_dir, scgnn_cfg.scgnn_cfg_dest
)
scgnn_cfg_file = os.path.join(scgnn_cfg.out_dir, scgnn_cfg.scgnn_cfg_dest)
with open(scgnn_cfg_file, "w") as f:
scgnn_cfg.dump(stream=f)
def load_scgnn_cfg(scgnn_cfg, args):
def load_cfg(scgnn_cfg, args):
r"""
Load configurations from file system and command line
Args:
@ -116,8 +112,6 @@ def set_out_dir(out_dir, fname):
# Make output directory
if scgnn_cfg.train.auto_resume:
os.makedirs(scgnn_cfg.out_dir, exist_ok=True)
else:
makedirs_rm_exist(scgnn_cfg.out_dir)
def set_run_dir(out_dir):
@ -131,8 +125,6 @@ def set_run_dir(out_dir):
# Make output directory
if scgnn_cfg.train.auto_resume:
os.makedirs(scgnn_cfg.run_dir, exist_ok=True)
else:
makedirs_rm_exist(scgnn_cfg.run_dir)
set_scgnn_cfg(scgnn_cfg)

View file

@ -122,7 +122,8 @@ def set_cfg(explaining_cfg):
explaining_cfg.accelerator = "auto"
# which objectives metrics to computes, either all or one in particular if implemented
explaining_cfg.metrics = "all"
explaining_cfg.metrics = CN()
explaining_cfg.metrics.type = "all"
# Whether or not recomputing metrics if they already exist
explaining_cfg.metrics.force = False