Skip to content

Commit

Permalink
stage progress on tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
voorhs committed Dec 7, 2024
1 parent 44db77e commit 8caf9cf
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 41 deletions.
8 changes: 2 additions & 6 deletions docs/source/docs_utils/notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,11 @@ def link_to_doc_page(
if page_type == "class":
dotpath = "autointent" + (("." + dotpath) if dotpath != "" else "")
path = "/".join(dotpath.split("."))
return f"../autoapi/{path}/{obj}.html" + (
f"#{dotpath}.{obj}" if obj is not None else ""
)
return f"../autoapi/{path}/{obj}.html" + (f"#{dotpath}.{obj}" if obj is not None else "")
if page_type == "method":
dotpath = "autointent" + (("." + dotpath) if dotpath != "" else "")
path = "/".join(dotpath.split("."))
return f"../autoapi/{path}.html" + (
f"#{dotpath}.{obj}" if obj is not None else ""
)
return f"../autoapi/{path}.html" + (f"#{dotpath}.{obj}" if obj is not None else "")
if page_type == "tutorial":
return f"../tutorials/tutorials.{dotpath}.py"
if page_type == "rst":
Expand Down
26 changes: 25 additions & 1 deletion tutorials/auto_configuration/python_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,29 @@
"""
## Vector Index Settings
%mddoclink(class,context.vector_index_client,VectorIndex) is one of the key utilities of AutoIntent. It affects both the quality of the resulting classifier and the efficiency of the auto configuration process.
%mddoclink(class,context.vector_index_client,VectorIndex) is one of the key utilities of AutoIntent. During the auto-configuration process, lots of retrieval is used. By modifying vector index settings you can select whether to save built vector index into file system and where to save it.
Default options are the following:
"""

# %%
from autointent.configs import VectorIndexConfig

vector_index_config = VectorIndexConfig(
db_dir=None,
save_db=False
)

# %% [markdown]
"""
- `db_dir=None` tells AutoIntent to store intermediate files in a current working directory
- `save_db=False` tells AutoIntent to clear all the files after auto configuration is finished
These settings can be applied in a familiar way:
"""

# %%
custom_pipeline.set_config(vector_index_config)

# %% [markdown]

45 changes: 11 additions & 34 deletions tutorials/auto_configuration/search_space_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
knn_module = {
"module_type": "knn",
"k": [1, 5, 10, 50],
"embedder_name": [
"avsolatorio/GIST-small-Embedding-v0",
"infgrad/stella-base-en-v2"
]
"embedder_name": ["avsolatorio/GIST-small-Embedding-v0", "infgrad/stella-base-en-v2"],
}

# %% [markdown]
Expand Down Expand Up @@ -62,7 +59,7 @@
"search_space": [
knn_module,
linear_module,
]
],
}

# %% [markdown]
Expand All @@ -81,48 +78,28 @@
{
"module_type": "vector_db",
"k": [10],
"embedder_name": [
"avsolatorio/GIST-small-Embedding-v0",
"infgrad/stella-base-en-v2"
]
"embedder_name": ["avsolatorio/GIST-small-Embedding-v0", "infgrad/stella-base-en-v2"],
}
]
],
},
{
"node_type": "scoring",
"metric": "scoring_roc_auc",
"search_space": [
{"module_type": "knn", "k": [1, 3, 5, 10], "weights": ["uniform", "distance", "closest"]},
{"module_type": "linear"},
{
"module_type": "knn",
"module_type": "dnnc",
"cross_encoder_name": ["BAAI/bge-reranker-base", "cross-encoder/ms-marco-MiniLM-L-6-v2"],
"k": [1, 3, 5, 10],
"weights": ["uniform", "distance", "closest"]
},
{
"module_type": "linear"
},
{
"module_type": "dnnc",
"cross_encoder_name": [
"BAAI/bge-reranker-base",
"cross-encoder/ms-marco-MiniLM-L-6-v2"
],
"k": [1, 3, 5, 10]
}
]
],
},
{
"node_type": "prediction",
"metric": "prediction_accuracy",
"search_space": [
{
"module_type": "threshold",
"thresh": [0.5]
},
{
"module_type": "argmax"
}
]
}
"search_space": [{"module_type": "threshold", "thresh": [0.5]}, {"module_type": "argmax"}],
},
]

# %% [markdown]
Expand Down

0 comments on commit 8caf9cf

Please sign in to comment.