czbenchmarks.utils
Attributes
Functions
|
Initialize Hydra configuration system. |
|
Import a class based on the _target_ field in a configuration file. |
|
Customize czbenchmarks parameters for class instantiation |
Module Contents
- czbenchmarks.utils.logger
- czbenchmarks.utils.DEFAULT_HYDRA_CONFIG_PATH = './conf'
- czbenchmarks.utils.initialize_hydra(config_path=DEFAULT_HYDRA_CONFIG_PATH)[source]
Initialize Hydra configuration system.
This function sets up Hydra’s configuration system using the specified configuration directory. If Hydra is already initialized, it clears the existing instance before reinitializing.
- Parameters:
config_path (str) – Path to the configuration directory.
- Returns:
None
- czbenchmarks.utils.import_class_from_config(config_path: str)[source]
Import a class based on the _target_ field in a configuration file.
This function reads a configuration file, extracts the _target_ field, and dynamically imports the specified class.
- Parameters:
config_path (str) – Path to the configuration file.
- Returns:
The imported class object.
- Return type:
class_obj
- Raises:
AttributeError – If the specified class does not exist in the module.
ImportError – If the module cannot be imported.
- czbenchmarks.utils.load_custom_config(item_name: str, config_name: str, custom_config_path: str | None = None, class_update_kwargs: Dict[str, Any] | None = None)[source]
Customize czbenchmarks parameters for class instantiation
- Parameters:
config_name – Name of the czbenchmarks config to load, e.g. “datasets” for “datasets.yaml”.
item_name – Item from the czbenchmarks config to load, e.g. “replogle_k562_essential_perturbpredict” for “datasets.yaml”. If the item is not in the config, a new item will be created.
custom_config_path – Optional path to a YAML file containing a custom configuration that can be used to update the existing default configuration.
class_update_kwargs – Optional dictionary of parameters to update those used for class instantiation
- Returns:
Configuration