Closed vcarpani closed 5 years ago
Ah I see, not exactly what I had in mind. In git you can override your username and email like:
git -c user.name="Vivek Sury" -c user.email="v.sury@fizyr.com" commit
Likewise, as in your example, you could do:
python ./train.py -o backbone.name=resnet -o generator.name=coco -o generator.details.data_dir=/srv/datasets/COCO
It's a bit more work to parse these options (basically you would need to convert them to a dictionary), but it's more in line with other Linux tools.
This may also be very helpful with modules and multiple argument parsers, have a look to see if you think it's something we can use.
[This] may also be very helpful with modules and multiple argument parsers, have a look to see if you think it's something we can use.
I dont see any link
Unfortunately that library supports yaml list only in this format:
fruit: [apple, orange, lemon]
Not:
fruit:
- apple
- orange
- lemon
Should be done now, the parsing is:
python ./train.py --gpu 1 -o backbone.name=resnet -o generator.name=coco -o generator.details.data_dir=/srv/datasets/COCO
Unfortunately that library supports yaml list only in this format:
Hmm that is unfortunate. Still, it's maybe worth considering replacing argparse
with something else (maybe still configargparse
eventhough it doesn't support full yaml).
Checked that YAML parsing a bit for configargparse
, the default parser doesn't allow for yaml in the form of:
fruits:
- apples
- pears
but if you construct the configargparse object like so:
p = configargparse.ArgParser(config_file_parser_class=configargparse.YAMLConfigFileParser)
Then it forces to use a YAML parser, which allows a more complete (full?) YAML syntax, including the multiline list syntax. The default parser is a flexible parser, allowing YAML / ini syntax, but then it is a bit limited in the exact syntax.
@enricoliscio can you have a look at this?
This PR adds the parsing of additional options, here's an example:
python ./train.py --o "{'backbone': {'name': 'resnet'}, 'generator': {'name': 'coco', 'details': {'data_dir': '/srv/datasets/COCO'}}}"
Also adds first draft of documentation.
Fix #20