Open MatSci ML Toolkit is a framework for prototyping and scaling out deep learning models for materials discovery supporting widely used materials science datasets, and built on top of PyTorch Lightning, the Deep Graph Library, and PyTorch Geometric.
MIT License
144
stars
20
forks
source link
[Feature request]: Support `*args` unpacking when creating classes in the experiment CLI #290
Some classes unpack a list of arguments (*args) as part of the instantiation process, namely matsciml.lightning.callbacks.LossScalingSchedule. Essentially, what we want to be able to do in the trainer configuration is this:
Right now if the above configuration is used, we get the following error:
TypeError: LossScalingScheduler.__init__() got an unexpected keyword argument 'class_path'
Request attributes
[X] Would this be a refactor of existing code?
[ ] Does this proposal require new package dependencies?
[ ] Would this change break backwards compatibility?
[ ] Does this proposal include a new model?
[ ] Does this proposal include a new dataset?
[ ] Does this proposal include a new task/workflow?
Related issues
No response
Solution description
Potentially modify experiments.utils.utils.instantiate_arg_dict to support unpacking a list of class specifications. Trouble is this might need a bit more complexity since you might need to actually inspect the arguments (i.e. with argspec).
Feature/behavior summary
Some classes unpack a list of arguments (
*args
) as part of the instantiation process, namelymatsciml.lightning.callbacks.LossScalingSchedule
. Essentially, what we want to be able to do in thetrainer
configuration is this:The idea is to allow
init_args
be a list of arguments, each of which are specs to create objects from; the API version would look like this:Right now if the above configuration is used, we get the following error:
Request attributes
Related issues
No response
Solution description
Potentially modify
experiments.utils.utils.instantiate_arg_dict
to support unpacking a list of class specifications. Trouble is this might need a bit more complexity since you might need to actually inspect the arguments (i.e. withargspec
).Additional notes
No response