lightningCLI : how to set a list parameters in commandline? #16210
-
I'm using lightningCLI, I wanna to know , if trainer.plugins is a list such as ['AlpsLightningEnvironment', 'AntCheckpointIO'], how can i set the commandline ? (i set --trainer.plugins ['AlpsLightningEnvironment', 'AntCheckpointIO'] got error) one more question, I want set callbacks of ModelCheckpoint like this : "--trainer.callbacks ModelCheckpoint --trainer.callbacks.ModelCheckpoint.dirpath tmp_dir/torch_train_v2.pt", but got trainer_init error. how to set path correctly? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The CLI parses values as yaml/json. You need to make sure that what you give is valid and not incorrectly interpreted by your shell. Probably you will need to add quotes so that your shell does not split things into different arguments, i.e. Explanation about how to provide init args of a subclass in a list from command line is here trainer-callbacks-and-arguments-with-class-type. Note that as arguments become complex, it is preferable that you use a config file and get some help from |
Beta Was this translation helpful? Give feedback.
The CLI parses values as yaml/json. You need to make sure that what you give is valid and not incorrectly interpreted by your shell. Probably you will need to add quotes so that your shell does not split things into different arguments, i.e.
--trainer.plugins '["AlpsLightningEnvironment", "AntCheckpointIO"]'
. Not sure if those values are correct, but the point is adding quotes so that the entire list is considered a single argument.Explanation about how to provide init args of a subclass in a list from command line is here trainer-callbacks-and-arguments-with-class-type.
Note that as arguments become complex, it is preferable that you use a config file and get some help from
--print_config
…