defensegan
defensegan copied to clipboard
absl.flags._exceptions.UnrecognizedFlagError: Unknown command line flag 'cfg'. Did you mean: cfg_path ?
I follow ur instrumentation,but when I wanna train. absl.flags._exceptions.UnrecognizedFlagError: Unknown command line flag 'cfg'. Did you mean: cfg_path ?
This problem troubled me. How to solve this problem.hope to get ur answer. thanks
I know how to deal with this problem!
My code is shown here:
flags = tf.compat.v1.app.flags
if not os.path.exists(cfg_path):
raise RuntimeError(
"[!] Configuration path {} does not exist.".format(cfg_path))
if os.path.isdir(cfg_path):
cfg_path = os.path.join(cfg_path, 'cfg.yml')
with open(cfg_path, 'r') as f:
cfg = yaml.safe_load(f)
else:
with open(cfg_path, 'r') as f:
loaded_cfg = yaml.safe_load(f)
base_dir = os.path.dirname(cfg_path)
with open(os.path.join(base_dir, 'default.yml'), 'r') as f:
cfg = yaml.safe_load(f)
cfg.update(loaded_cfg)
with open(os.path.join('experiments/cfgs', 'key_doc.yml')) as f:
docs = yaml.safe_load(f)
flags.DEFINE_string('cfg_path', cfg_path, 'config path.')