autointent.Pipeline#

class autointent.Pipeline(nodes, seed=42)#

Pipeline optimizer class.

See tutorial on AutoML features of AutoIntent in User Guides.

Parameters:
nodes#
set_config(config)#

Set the configuration for the pipeline.

Parameters:

config (autointent.configs.LoggingConfig | autointent.configs.EmbedderConfig | autointent.configs.CrossEncoderConfig | autointent.configs.DataConfig | autointent.configs.HFModelConfig | autointent.configs.HPOConfig | autointent.configs.VectorIndexConfig) – Configuration object.

Return type:

None

classmethod from_search_space(search_space, seed=42)#

Instantiate pipeline optimizer from given search space.

Parameters:
Return type:

Pipeline

classmethod from_preset(name, seed=42)#

Instantiate pipeline optimizer from a preset.

Parameters:
  • name (autointent.custom_types.SearchSpacePreset)

  • seed (int)

Return type:

Pipeline

classmethod from_optimization_config(config)#

Create pipeline optimizer from optimization config.

Parameters:

config (dict[str, Any] | pathlib.Path | str | autointent.OptimizationConfig) – dictionary or a path to yaml file.

Return type:

Pipeline

fit(dataset, refit_after=False, incompatible_search_space='filter', preflight='off')#

Optimize the pipeline from dataset.

Parameters:
  • dataset (autointent.Dataset) – dataset for optimization.

  • refit_after (bool) – whether to refit on whole data after optimization. Valid only for hold-out validaiton.

  • incompatible_search_space (autointent.custom_types.SearchSpaceValidationMode) – how to handle data-incompatible modules occurring in search space.

  • preflight (PreflightMode) – experimental gate that runs autointent.advisor.run_preflight() over the pipeline’s effective config + dataset before any heavy work. "off" (default) skips it entirely. "warn" logs findings — INFO for AMPLE, WARNING for TIGHT, ERROR for OVER — but never raises; note it probes the HF Hub for model metadata, so it adds network round-trips. "strict" additionally raises autointent.advisor.PreflightError when any finding has severity OVER, so unfeasible runs abort before fit.

Raises:
Return type:

autointent.Context

dump(path=None)#

Dump pipeline to disk.

One can reuse it for inference later with autointent.Pipeline.load().

Parameters:

path (str | pathlib.Path | None)

Return type:

None

validate_modules(dataset, mode)#

Validate modules with dataset.

Parameters:
  • dataset (autointent.Dataset) – Dataset for validation.

  • mode (autointent.custom_types.SearchSpaceValidationMode) – Validation mode.

Return type:

None

classmethod from_config(nodes_configs)#

Create inference pipeline from config.

Parameters:

nodes_configs (list[autointent.configs.InferenceNodeConfig]) – list of config for nodes

Return type:

Pipeline

classmethod load(path, embedder_config=None, cross_encoder_config=None)#

Load pipeline in inference mode.

Parameters:
Return type:

Pipeline

predict(utterances)#

Predict the labels for the utterances.

Parameters:

utterances (list[str]) – list of utterances

Return type:

autointent.custom_types.ListOfGenericLabels

predict_with_metadata(utterances)#

Predict the labels for the utterances with metadata.

Parameters:

utterances (list[str]) – list of utterances

Return type:

autointent._pipeline._schemas.InferencePipelineOutput