otx.core.utils.instantiators#

Instantiator functions for OTX engine components.

Functions

instantiate_callbacks(callbacks_cfg)

Instantiate a list of callbacks based on the provided configuration.

instantiate_loggers(logger_cfg)

Instantiate loggers based on the provided logger configuration.

instantiate_sampler(sampler_config, dataset, ...)

Instantiate a sampler object based on the provided configuration.

partial_instantiate_class(init)

Partially instantiates a class with the given initialization arguments.

otx.core.utils.instantiators.instantiate_callbacks(callbacks_cfg: list) list[Callback][source]#

Instantiate a list of callbacks based on the provided configuration.

Parameters:

callbacks_cfg (list) – A list of callback configurations.

Returns:

A list of instantiated callbacks.

Return type:

list[Callback]

otx.core.utils.instantiators.instantiate_loggers(logger_cfg: list | None) list[Logger][source]#

Instantiate loggers based on the provided logger configuration.

Parameters:

logger_cfg (list | None) – The logger configuration.

Returns:

The list of instantiated loggers.

Return type:

list[Logger]

otx.core.utils.instantiators.instantiate_sampler(sampler_config: SamplerConfig, dataset: Dataset, **kwargs) Sampler[source]#

Instantiate a sampler object based on the provided configuration.

Parameters:
  • sampler_config (SamplerConfig) – The configuration object for the sampler.

  • dataset (Dataset) – The dataset object to be sampled.

  • **kwargs – Additional keyword arguments to be passed to the sampler’s constructor.

Returns:

The instantiated sampler object.

Return type:

Sampler

otx.core.utils.instantiators.partial_instantiate_class(init: list | dict | None) list[partial] | None[source]#

Partially instantiates a class with the given initialization arguments.

Copy from lightning.pytorch.cli.instantiate_class and modify it to use partial.

Parameters:

init (list | dict | None) – A dictionary containing the initialization arguments. It should have the following each keys: - “init_args” (dict): A dictionary of keyword arguments to be passed to the class constructor. - “class_path” (str): The fully qualified path of the class to be instantiated.

Returns:

A partial object representing the partially instantiated class.

Return type:

list[partial] | None