Giter Site home page Giter Site logo

hydra-slayer's People

Contributors

bagxi avatar scitator avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

dimaorekhov

hydra-slayer's Issues

Extra arguments for meta_factory

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:

  1. Instead of get_from_params I use from_params.
  2. Some of the modules require lazy initialization.

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",
    },
};

How to configure creation of torch.tensor?

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>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.