Skip to content

Commit d5d1af0

Browse files
committed
fix docs building
1 parent 41e1d66 commit d5d1af0

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

user_guides/basic_usage/04_inference.py

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,31 @@
1515
# %%
1616
from autointent import Dataset, Pipeline
1717

18+
search_space = [
19+
{
20+
"node_type": "scoring",
21+
"metric": "scoring_roc_auc",
22+
"search_space": [
23+
{
24+
"module_name": "knn",
25+
"k": [1],
26+
"weights": ["uniform"],
27+
"embedder_name": ["avsolatorio/GIST-small-Embedding-v0"]
28+
},
29+
],
30+
},
31+
{
32+
"node_type": "decision",
33+
"metric": "decision_accuracy",
34+
"search_space": [
35+
{"module_name": "threshold", "thresh": [0.5]},
36+
{"module_name": "argmax"},
37+
],
38+
},
39+
]
40+
1841
dataset = Dataset.from_hub("AutoIntent/clinc150_subset")
19-
pipeline = Pipeline.default_optimizer(multilabel=False)
42+
pipeline = Pipeline.from_search_space(search_space)
2043
context = pipeline.fit(dataset)
2144
pipeline.predict(["hello, world!"])
2245

@@ -54,15 +77,12 @@
5477
"""
5578

5679
# %%
57-
from pathlib import Path
58-
5980
from autointent import Dataset, Pipeline
6081
from autointent.configs import LoggingConfig, VectorIndexConfig
6182

6283
dataset = Dataset.from_hub("AutoIntent/clinc150_subset")
63-
pipeline = Pipeline.default_optimizer(multilabel=False)
64-
dump_dir = Path("my_dumps")
65-
pipeline.set_config(LoggingConfig(dump_dir=dump_dir, dump_modules=True, clear_ram=True))
84+
pipeline = Pipeline.from_search_space(search_space)
85+
pipeline.set_config(LoggingConfig(dump_modules=True, clear_ram=True))
6686
pipeline.set_config(VectorIndexConfig(save_db=True))
6787

6888
# %% [markdown]
@@ -96,12 +116,3 @@
96116
"""
97117
## That's all!
98118
"""
99-
100-
# %%
101-
# [you didn't see it]
102-
import shutil
103-
104-
shutil.rmtree(dump_dir)
105-
106-
for file in Path.cwd().glob("vector_db*"):
107-
shutil.rmtree(file)

0 commit comments

Comments
 (0)