catalyst-team / hydra-slayer Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://catalyst-team.github.io/hydra-slayer
License: Apache License 2.0
Home Page: https://catalyst-team.github.io/hydra-slayer
License: Apache License 2.0
a:
_target_: list
iterable:
_target_: range
start: 0
stop: 10
step: 1
_mode_: call
_mode_: call
Hello,
Thank you for this package. It helps me a lot to keep modules initialization very readable and clean.
In my projects, I often use from_params
classmethod
to instantiate modules from complex jsonnet
config. In general, it works great with hydra-slayer. However, there are some aspects:
get_from_params
I use from_params
.To accomplish that, I can modify _target_
to work with from_params
function or add custom methods to Registry
. All in all, it works fine, but it would be great if I could conveniently tell hydra-slayer through config to work with custom classmethod
for both call_meta_factory
and partial_meta_factory
.
For instance, something like that:
local init = {
"meta_factory": {
"_target_": "hydra_slayer.call_meta_factory",
"method": "from_params",
},
};
local lazy_init = {
"meta_factory": {
"_target_": "hydra_slayer.partial_meta_factory",
"method": "from_params",
},
};
I created this way:
x:
_target_: torch.tensor
_mode_: call
data: 1
and got the error:
Traceback (most recent call last):
File "/home/chekhovana/projects/kaggle/rsna/tests/test_config.py", line 13, in <module>
experiment_params = hydra_slayer.get_from_params(**config)
File "/home/chekhovana/miniconda3/envs/kaggle_rsna/lib/python3.9/site-packages/hydra_slayer/functional.py", line 244, in get_from_params
instance, _ = _recursive_get_from_params(
File "/home/chekhovana/miniconda3/envs/kaggle_rsna/lib/python3.9/site-packages/hydra_slayer/functional.py", line 214, in _recursive_get_from_params
params[key], vars_dict = _recursive_get_from_params(
File "/home/chekhovana/miniconda3/envs/kaggle_rsna/lib/python3.9/site-packages/hydra_slayer/functional.py", line 219, in _recursive_get_from_params
instance, vars_dict = _get_from_params(params=params, vars_dict=vars_dict, **common_params)
File "/home/chekhovana/miniconda3/envs/kaggle_rsna/lib/python3.9/site-packages/hydra_slayer/functional.py", line 175, in _get_from_params
obj = _get_instance(
File "/home/chekhovana/miniconda3/envs/kaggle_rsna/lib/python3.9/site-packages/hydra_slayer/functional.py", line 109, in _get_instance
args_, kwargs = _extract_positional_keyword_vars(factory, kwargs=kwargs)
File "/home/chekhovana/miniconda3/envs/kaggle_rsna/lib/python3.9/site-packages/hydra_slayer/functional.py", line 33, in _extract_positional_keyword_vars
signature = inspect.signature(func)
File "/home/chekhovana/miniconda3/envs/kaggle_rsna/lib/python3.9/inspect.py", line 3113, in signature
return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
File "/home/chekhovana/miniconda3/envs/kaggle_rsna/lib/python3.9/inspect.py", line 2862, in from_callable
return _signature_from_callable(obj, sigcls=cls,
File "/home/chekhovana/miniconda3/envs/kaggle_rsna/lib/python3.9/inspect.py", line 2329, in _signature_from_callable
return _signature_from_builtin(sigcls, obj,
File "/home/chekhovana/miniconda3/envs/kaggle_rsna/lib/python3.9/inspect.py", line 2147, in _signature_from_builtin
raise ValueError("no signature found for builtin {!r}".format(func))
ValueError: no signature found for builtin <built-in method tensor of type object at 0x7f3f434d4140>
Sometimes pydoc.locate
fails to locate modules in local dir. Probably because local directory changes to something else.
PYTHONPATH=.:$PYTHONPATH catalyst-dl run -C config.yml
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.