autointent.Context#

class autointent.Context(seed=42)#

Context manager for configuring and managing data handling, vector indexing, and optimization.

This class provides methods to set up logging, configure data and vector index components, manage datasets, and retrieve various configurations for inference and optimization. Not intended to be instantiated by user.

Parameters:

seed (int | None)

data_handler: autointent.context.data_handler.DataHandler#

Convenient wrapper for autointent.Dataset.

optimization_info: autointent.context.optimization_info.OptimizationInfo#

Object for storing optimization trials and inter-node communication.

callback_handler#

Internal callback for logging to tensorboard or wandb.

seed = 42#
configure_logging(config)#

Configure logging settings.

Parameters:

config (autointent.configs.LoggingConfig) – Logging configuration settings.

Return type:

None

configure_transformer(config)#

Configure the vector index client and embedder.

Parameters:

config (autointent.configs.EmbedderConfig | autointent.configs.CrossEncoderConfig) – configuration for the transformers to use during optimization.

Return type:

None

set_dataset(dataset, config)#

Set the datasets for training, validation and testing.

Parameters:
Return type:

None

dump()#

Save all information about optimization process to disk.

Save metrics, hyperparameters, inference, configurations, and datasets to disk.

Return type:

None

get_dump_dir()#

Get the directory for saving dumped modules.

Return path to the dump directory or None if dumping is disabled.

Return type:

pathlib.Path | None

is_multilabel()#

Check if the dataset is configured for multilabel classification.

Return type:

bool

is_ram_to_clear()#

Check if RAM clearing is enabled in the logging configuration.

Return type:

bool

has_saved_modules()#

Check if any modules have been saved in RAM.

Return type:

bool

resolve_embedder()#

Resolve the embedder configuration.

Returns the best embedder configuration or default configuration.

Raises:

RuntimeError – If embedder configuration cannot be resolved.

Return type:

autointent.configs.EmbedderConfig

resolve_ranker()#

Resolve the cross-encoder configuration.

Returns default config if set.

Raises:

RuntimeError – If cross-encoder configuration cannot be resolved.

Return type:

autointent.configs.CrossEncoderConfig