PetrochukM / HParams

Configure Python functions explicitly and safely
MIT License
126 stars 8 forks source link

enhancements for command line arguments #2

Open greaber opened 4 years ago

greaber commented 4 years ago

This is an issue to discuss possible enhancements around cli overrides. Curious to hear thoughts as I have some ideas, but I haven't reflected on them a long time, and I'm not sure if they are good.

The syntax for command line arguments is verbose:

file.py --torch.optim.adam.Adam.__init__ 'HParams(lr=0.1,betas=(0.999,0.99))'

Just thinking off the top of my head here, but maybe it could be instead something like

file.py ,Adam[lr=0.1,betas=[0.999,0.99]]

Ideas here: , indicates args to be parsed by HParams; Adam just needs to match a unique substring; __init__ is the default method; no need to explicitly write HParams; brackets instead of parens to lessen the need for quotation.

Of course, for the most commonly used cli args, maybe it is already relatively straightforward to explicitly set up shortcuts so that you could write something like

file.py --lr .1 --beta1 .999 --beta2 .99

Possibly some small utility function in the libary could make setting up short custom args like these even easier.

Also, something that I don't know too much about but could be interesting to investigate is automating bash tab completion.

PetrochukM commented 4 years ago

Thanks for the suggestion!

I do agree that the command line can be a bit verbose. There is an opprotunity to make it a bit less verbose.