BUG: `CLI` struggles to parse multiple configurations in a single `config.yaml`
🐛 Bug report
When you have multiple configurations:
setup_config:
property_1: ...
...
run_config:
property_1: ...
...
CLI fails with the following error if the configurations are implemented using pydantic.BaseModel:
usage: main.py [-h] [--config CONFIG] [--print_config[=flags]] [--retrieval_pipeline_config CONFIG]
[--retrieval_pipeline_config.queries_path QUERIES_PATH] [--retrieval_pipeline_config.query QUERY]
[--retrieval_pipeline_config.search_config CONFIG] [--retrieval_pipeline_config.search_config.top_k TOP_K]
[--retrieval_pipeline_config.search_config.search_type {keyword,vector,hybrid}]
[--retrieval_pipeline_config.search_config.normalization_constant NORMALIZATION_CONSTANT]
[--retrieval_pipeline_config.output_path OUTPUT_PATH] [--retrieval_pipeline_config.batch_size BATCH_SIZE]
error: Validation failed: Group 'retriever_config' does not accept nested key 'embedding_provider_config.model_id'
As you can see, the retriever_config doesn't show any options. It isn't being parsed correctly.
To reproduce
- create 2 data models for dummy configs using
pydantic - use the
Fieldproperty to assign adefault_factory=regular dataclass
Expected behavior
Parse both configs, this works fine when they are implemented with regular data classes.
Environment
- jsonargparse version: 4.43.0
- Python version: 3.12
- How jsonargparse was installed: PyPI
- OS: Mac M1
Thank you for reporting!
Could you please in the "To reproduce" section provide a complete code snippet and corresponding yaml config that causes the error shown.
Ouch that might be tricky, it's confidential.
Although, I can empathise @mauvilsa - the issue is lacking in detail.
Do you want me to look into it myself?
I go on vacation tomorrow, will have some time since it's not holidays quite yet.
You don't need to add confidential data. You wrote two bullet points. Just do that to create a dummy example. You are the one who understands the code, so it is best that you create the minimal reproduction example.
Do you want me to look into it myself?
No. Just the idea is that anyone can easily reproduce the issue. And the reproduction not depend on misinterpreting or incomplete instructions.