[Bug] utils.instantiate fails with dict kwarg inputs
See original GitHub issue🐛 Bug
utils.instantiate
fails with dict kwarg inputs
To reproduce
Minimal Code/Config snippet to reproduce
Suppose I have a config group file
model:
class: models.Net
params:
some: 0
values: 1
Let’s say I want to pass in a dictionary to models.Net
as follows:
utils.instantiate(cfg.model, some_config_argument={'test': 'dict'})
Stack trace/error message
This will throw KeyError: 'Accessing unknown key in a struct : model.params.test'
from params.merge_with(OmegaConf.create(kwargs))
in the instantiate function.
Expected Behavior
Expected to succeed and pass in the dict kwarg to the class constructor
System information
- Hydra Version : 0.11.0
- Python version : 3.7.6
- Virtual environment type and version : Conda
- Operating system : OS X
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Converting Python dict to kwargs? - Stack Overflow
I want to build a query for sunburnt(solr interface) using class inheritance and therefore adding key - value pairs together. The sunburnt ...
Read more >Utilities — MONAI 1.1.0 Documentation
Create an object instance or partial function from a class or function represented by string. kwargs will be part of the input arguments...
Read more >Globals - Bazel
It is an error if the implementation function omits any of the types of providers listed here from its return value. However, the...
Read more >Supported Python features - Numba
Explicit **kwargs are not supported. Function calls to locally defined inner functions are supported as long as they can be fully inlined.
Read more >Pipelines - Hugging Face
from transformers import pipeline from transformers.pipelines.pt_utils import ... inputs ( np.ndarray or bytes or str or dict ) — The inputs is either...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
closing as fixed in master. feel free to join the chat if you have questions.
Awesome that it works on master. if you can stick to master to give it some testing as it evolves please do. (generally all tests are passing in master).
If I am understanding your problem correctly, try something like:
config.yaml
optimizer/adam.yaml