For management of my config files, I’m using Hydra which requires passing additional arguments using a plus and then an equal sign between the argument and its value, e.g.
python evaluate.py '+model_path="logs/fc/version_1/checkpoints/epoch=1-step=2.ckpt"'
Above I’m also using quotes to escape the equal signs in the value.
I want to pass this in vscode to launch.json
to the args
field; however, I don’t know how to do it properly because typically the argument and value parts are separated by a space and not an equal sign as for Hydra. So the following doesn’t work:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"args" : ["+model_path", "logs/fc/version_1/checkpoints/epoch=1-step=2.ckpt"]
}
]
}
How should I change args
to get it right?
2
Answers
This may not be the most elegant solution but it works if we pass everything as a single argument (no comma inbetween) like this:
"args" : ["+model_path='logs/fc/version_7/checkpoints/epoch=19-step=3700.ckpt'"]
Use the following syntax:
If you pass paired arguments with
args
:There are more details on launch.json configuration here.