Open vinnamkim opened 5 months ago
I would consider this a bug. The behavior of a class instance type hint, when overriding a single init arg of the class, is only to change that arg and keep all other init_args as before. But this seems to not be working for callables that return a class instance. The behavior must be consistent for these two cases.
Note that in #460 there is a request to always reset to defaults. If this gets implemented still the default behavior should be the overriding that you want.
Thank you for reporting!
Initially I had though that overriding of arguments was not working correctly for all callable types that return a class. However, after another look I noticed that without the list, i.e. scheduler: LRSchedulerCallable
, the overriding works correctly. Thus, the issue is only when the type is nested. Unfortunately this might mean it is more difficult to fix.
Another comment unrelated to the bug. In the reproduction code the default for schedulers
is invalid because it is not a list of callables.
This is a minimal reproduction. If I have this Python code which implements
jsonargparse.ArgumentParser
, and this YAML configuration file for it.
What I want to is to override the
monitor
value ofReduceLROnPlateau
without changing the other configuration values in the YAML file. For example,The expect output I want is
However, what I got is
The other values of
ReduceLROnPlateau
are reset to its default, not ones in the configuration file.Is there any method to allow this kind of overriding?