Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for a list of nested objects #385

Open
memray opened this issue Sep 17, 2023 · 1 comment
Open

Support for a list of nested objects #385

memray opened this issue Sep 17, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@memray
Copy link

memray commented Sep 17, 2023

Hi there,

Great tool! I wonder if it is possible to load/dump configs as a list of nested objects/dataclasses, like the data shown below? It's quite common for ML projects. Thanks!
https://github.com/OpenNMT/OpenNMT-py/blob/master/data/features_data.yaml

image

@memray memray added the enhancement New feature or request label Sep 17, 2023
@mauvilsa
Copy link
Member

Types like list[<subtype>] are supported. The subtype could be simple, like an int, or complex like a dataclass or a base class to accept subclasses. See for example pytorch lightning's callbacks (LightningCLI is jsonargparse under the hood). The config above doesn't look like a list. Looks more like nested dataclasses, which are also supported.

Note that jsonargparse was developed based on machine learning needs and most of its users are from this community. Depending on what you want, I could advice how to best proceed. Feel free to ask.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants