Creating custom configs in graphgym/contrib does not currently work correctly as far as I can tell.
Trying to specify example_arg or example_group -- arguments from the example contrib config -- yields an error as the config does not have those keys resolved yet, so cfg merge method refuses to merge unrecognized keys.
Traceback (most recent call last):
File "/home/rdyro/Desktop/GraphGym/run/main.py", line 23, in <module>
load_cfg(cfg, args)
File "/home/rdyro/.pyenv/versions/devel/lib/python3.9/site-packages/graphgym/config.py", line 517, in load_cfg
cfg.merge_from_file(args.cfg_file)
File "/home/rdyro/.pyenv/versions/devel/lib/python3.9/site-packages/yacs/config.py", line 213, in merge_from_file
self.merge_from_other_cfg(cfg)
File "/home/rdyro/.pyenv/versions/devel/lib/python3.9/site-packages/yacs/config.py", line 217, in merge_from_other_cfg
_merge_a_into_b(cfg_other, self, self, [])
File "/home/rdyro/.pyenv/versions/devel/lib/python3.9/site-packages/yacs/config.py", line 491, in _merge_a_into_b
raise KeyError("Non-existent config key: {}".format(full_key))
KeyError: 'Non-existent config key: example_arg'
The issue seems to have to do these line within the set_cfg function
for func in register.config_dict.values():
func(cfg)
which operate over an empty dictionary, because graphgym.contrib has not yet been imported at that stage. However, importing graphgym.contrib directly in the config file leads to another set of errors as a couple of examples in graphgym.contrib rely on cfg having been initialized to the default structure.
The fix appears to require:
setting the cfg tree to a default structure with set_cfg(cfg)
importing the gaphgym.contrib tree
rerunning the following lines in the global file definition to now properly register custom config fields
for func in register.config_dict.values():
func(cfg)
Creating custom configs in
graphgym/contrib
does not currently work correctly as far as I can tell.Trying to specify
example_arg
orexample_group
-- arguments from the example contrib config -- yields an error as the config does not have those keys resolved yet, so cfg merge method refuses to merge unrecognized keys.The issue seems to have to do these line within the
set_cfg
functionwhich operate over an empty dictionary, because
graphgym.contrib
has not yet been imported at that stage. However, importinggraphgym.contrib
directly in the config file leads to another set of errors as a couple of examples ingraphgym.contrib
rely oncfg
having been initialized to the default structure.The fix appears to require:
set_cfg(cfg)