Skip to content

Hydra config utils

get_target_of_config #

get_target_of_config(
    config_group: str,
    config_name: str,
    _cs: ConfigStore | None = None,
) -> Callable

Returns the class that is to be instantiated by the given config name.

In the case of inner dataclasses (e.g. Model.HParams), this returns the outer class (Model).

import_object #

import_object(target_path: str)

Imports the object at the given path.

Examples#

assert False

get_all_configs_in_group_of_type #

get_all_configs_in_group_of_type(
    config_group: str,
    config_target_type: type | tuple[type, ...],
    include_subclasses: bool = True,
    excluding: type | tuple[type, ...] = (),
) -> list[str]

Returns the names of all the configs in the given config group that have this target or a subclass of it.

get_all_configs_in_group_with_target #

get_all_configs_in_group_with_target(
    group_name: str, some_type: type
) -> list[str]

Retrieves the names of all the configs in the given group that are used to construct objects of the given type.