Created
April 12, 2021 19:12
-
-
Save gar1t/3f91e02435daaffb13fb7e32830449b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[FLAGS] | |
lr = 0.01 | |
dropout = 0.2 | |
[OTHER] | |
foo = hello | |
bar = 123.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
op: | |
main: op --config config.ini | |
flags-dest: config:config.ini | |
flags-import: | |
- FLAGS.lr | |
- FLAGS.dropout | |
flags: | |
lr: | |
arg-name: FLAGS.lr | |
dropout: | |
arg-name: FLAGS.dropout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import configparser | |
p = argparse.ArgumentParser() | |
p.add_argument("--config") | |
args = p.parse_args() | |
cfg = configparser.ConfigParser() | |
cfg.read(args.config) | |
flags = cfg["FLAGS"] | |
for name, val in sorted(flags.items()): | |
print("%s=%s" % (name, val)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment