-
-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Description
Hello! I would like to ask what is a good way to handle optional class instances? For example, instantiating a validation dataset. In the original Python code, it would look like this:
if args.val_dataset is not None:
# instantiate the validation set class
However, add_class_arguments()
doesn't support optional instances. To work around this, I'm currently using add_subclass_arguments(required=False)
, but I find this approach suboptimal. Is there a better way to handle situations like this in jsonargparse
? Thank you.
Metadata
Metadata
Assignees
Labels
No labels