Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
voorhs committed Nov 6, 2024
1 parent d648849 commit e7d0fbd
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 4 deletions.
2 changes: 1 addition & 1 deletion autointent/pipeline/inference/inference_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def __init__(self, nodes: list[InferenceNode]) -> None:
self.nodes = {n.node_type: n for n in nodes}

@classmethod
def from_config(cls, nodes_configs: list[InferenceNodeConfig]) -> None:
def from_config(cls, nodes_configs: list[InferenceNodeConfig]) -> "InferencePipeline":
nodes = [InferenceNode.from_config(cfg) for cfg in nodes_configs]
return cls(nodes)

Expand Down
54 changes: 51 additions & 3 deletions experiments/python-node-optimization/testbed.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"[I 2024-11-06 13:10:03,339] A new study created in memory with name: no-name-85c71fe7-cc94-448b-a9a0-46470688fb6b\n"
"[I 2024-11-06 13:31:52,764] A new study created in memory with name: no-name-4b9b4940-4128-414d-8733-3236f7935735\n"
]
}
],
Expand All @@ -165,16 +165,64 @@
"context.dump()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"inference_config = context.optimization_info.get_inference_nodes_config()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Run Inference from file system"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"from autointent.pipeline.inference import InferencePipeline\n",
"\n",
"inference_pipeline = InferencePipeline.from_config(inference_config)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n",
" [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]])"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"inference_pipeline.predict([\"hello world\", \"what is the eagles address\"])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Run Inference"
"## Run Inference from context [but from file system]"
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down

0 comments on commit e7d0fbd

Please sign in to comment.