Inference Pipeline#
After you configured optimal pipeline with AutoIntent, you probably want to test its power on some new data! There are several options:
use it right after optimization
save to file system and then load
Right After#
Here’s the basic example:
[1]:
from typing import Any
from autointent import Dataset, Pipeline
search_space: list[dict[str, Any]] = [
{
"node_type": "scoring",
"target_metric": "scoring_roc_auc",
"search_space": [
{
"module_name": "knn",
"k": [1],
"weights": ["uniform"],
"embedder_config": ["avsolatorio/GIST-small-Embedding-v0"],
},
],
},
{
"node_type": "decision",
"target_metric": "decision_accuracy",
"search_space": [
{"module_name": "threshold", "thresh": [0.5]},
{"module_name": "argmax"},
],
},
]
dataset = Dataset.from_hub("DeepPavlov/clinc150_subset")
pipeline = Pipeline.from_search_space(search_space)
context = pipeline.fit(dataset)
pipeline.predict(["hello, world!"])
/home/runner/work/AutoIntent/AutoIntent/.venv/lib/python3.12/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
from .autonotebook import tqdm as notebook_tqdm
Memory storage is not compatible with resuming optimization. Modules from previous runs won't be available. Set dump_modules=True in LoggingConfig to enable proper resuming.
/home/runner/work/AutoIntent/AutoIntent/src/autointent/nodes/_node_optimizer.py:82: FutureWarning: `consider_prior` has been deprecated in v4.3.0. This feature will be removed in v6.0.0. See https://github.com/optuna/optuna/releases/tag/v4.3.0.
sampler_instance = optuna.samplers.TPESampler(
/home/runner/work/AutoIntent/AutoIntent/src/autointent/nodes/_node_optimizer.py:82: FutureWarning: `prior_weight` has been deprecated in v4.9.0. This feature will be removed in v6.0.0. See https://github.com/optuna/optuna/releases/tag/v4.9.0.
sampler_instance = optuna.samplers.TPESampler(
Storage directory must be provided for study persistence.
[I 2026-06-17 19:16:59,116] A new study created in memory with name: NodeType.scoring
/home/runner/work/AutoIntent/AutoIntent/src/autointent/nodes/_node_optimizer.py:82: FutureWarning: `consider_prior` has been deprecated in v4.3.0. This feature will be removed in v6.0.0. See https://github.com/optuna/optuna/releases/tag/v4.3.0.
sampler_instance = optuna.samplers.TPESampler(
/home/runner/work/AutoIntent/AutoIntent/src/autointent/nodes/_node_optimizer.py:82: FutureWarning: `prior_weight` has been deprecated in v4.9.0. This feature will be removed in v6.0.0. See https://github.com/optuna/optuna/releases/tag/v4.9.0.
sampler_instance = optuna.samplers.TPESampler(
Storage directory must be provided for study persistence.
"argmax" is NOT designed to handle OOS samples, but your data contains it. So, using this method reduces the power of classification.
/home/runner/work/AutoIntent/AutoIntent/.venv/lib/python3.12/site-packages/sklearn/metrics/_classification.py:1879: UndefinedMetricWarning: Precision is ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.
_warn_prf(average, modifier, f"{metric.capitalize()} is", result.shape[0])
[1]:
[3]
There are several caveats.
RAM usage.
You can optimize RAM usage by saving all modules to file system. Just set the following options:
[2]:
from autointent.configs import LoggingConfig
logging_config = LoggingConfig(dump_modules=True, clear_ram=True)
Load from File System#
Firstly, your auto-configuration run should dump modules into file system:
[3]:
from autointent import Dataset, Pipeline
from autointent.configs import LoggingConfig
dataset = Dataset.from_hub("DeepPavlov/clinc150_subset")
pipeline = Pipeline.from_search_space(search_space)
pipeline.set_config(LoggingConfig(dump_modules=True, clear_ram=True))
Secondly, after optimization finished, you need to save the auto-configuration results to file system:
[4]:
context = pipeline.fit(dataset)
context.dump()
# or pipeline.dump() to save only configured pipeline but not all the optimization assets
/home/runner/work/AutoIntent/AutoIntent/src/autointent/nodes/_node_optimizer.py:82: FutureWarning: `consider_prior` has been deprecated in v4.3.0. This feature will be removed in v6.0.0. See https://github.com/optuna/optuna/releases/tag/v4.3.0.
sampler_instance = optuna.samplers.TPESampler(
/home/runner/work/AutoIntent/AutoIntent/src/autointent/nodes/_node_optimizer.py:82: FutureWarning: `prior_weight` has been deprecated in v4.9.0. This feature will be removed in v6.0.0. See https://github.com/optuna/optuna/releases/tag/v4.9.0.
sampler_instance = optuna.samplers.TPESampler(
/home/runner/work/AutoIntent/AutoIntent/src/autointent/nodes/_node_optimizer.py:82: FutureWarning: `consider_prior` has been deprecated in v4.3.0. This feature will be removed in v6.0.0. See https://github.com/optuna/optuna/releases/tag/v4.3.0.
sampler_instance = optuna.samplers.TPESampler(
/home/runner/work/AutoIntent/AutoIntent/src/autointent/nodes/_node_optimizer.py:82: FutureWarning: `prior_weight` has been deprecated in v4.9.0. This feature will be removed in v6.0.0. See https://github.com/optuna/optuna/releases/tag/v4.9.0.
sampler_instance = optuna.samplers.TPESampler(
"argmax" is NOT designed to handle OOS samples, but your data contains it. So, using this method reduces the power of classification.
/home/runner/work/AutoIntent/AutoIntent/.venv/lib/python3.12/site-packages/sklearn/metrics/_classification.py:1879: UndefinedMetricWarning: Precision is ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.
_warn_prf(average, modifier, f"{metric.capitalize()} is", result.shape[0])
This command saves all results to the run’s directory:
[5]:
run_directory = context.logging_config.dirpath
run_directory
[5]:
PosixPath('/tmp/tmpruw7o63i/f2c2fceab771c3d9a13e68e7fe6bc2d0450c72ce/docs/source/user_guides/runs/rich_archaeopteryx_06-17-2026_19-17-05')
After that, you can load pipeline for inference:
[6]:
loaded_pipeline = Pipeline.load(run_directory)
loaded_pipeline.predict(["hello, world!"])
[6]:
[3]