Skip to content

Commit

Permalink
fix: OnnxRT EF now properly resolves ~ (#43)
Browse files Browse the repository at this point in the history
Closes #35
  • Loading branch information
tazarov authored Sep 10, 2024
1 parent 3a17034 commit fd5008b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion chromadbx/embeddings/onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def __init__(
):
raise ValueError("Preferred providers must be unique")
self._preferred_providers = preferred_providers
self._model_path = model_path
self._model_path = os.path.expanduser(model_path)
print(self._model_path)
self._max_length = max_length
self._enabled_padding = enabled_padding
try:
Expand Down
18 changes: 16 additions & 2 deletions experiments/ort_ef.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"from pathlib import Path\n",
"from chromadbx.embeddings.onnx import OnnxRuntimeEmbeddings\n",
"\n",
"ef=OnnxRuntimeEmbeddings(model_path=f\"{Path.home()}/.cache/chroma/onnx_models/all-MiniLM-L6-v2/onnx\",preferred_providers=[\"CPUExecutionProvider\"])\n",
"ef=OnnxRuntimeEmbeddings(model_path=f\"{Path.home()}/.cache/models/hf/all-MiniLM-L6-v2\",preferred_providers=[\"CPUExecutionProvider\"])\n",
"\n",
"ef([\"text\"])"
],
Expand Down Expand Up @@ -95,10 +95,24 @@
{
"metadata": {},
"cell_type": "code",
"source": "",
"source": [
"from chromadbx.embeddings.onnx import OnnxRuntimeEmbeddings\n",
"\n",
"ef=OnnxRuntimeEmbeddings(model_path=f\"~/.cache/models/hf/all-MiniLM-L6-v2\",preferred_providers=[\"CPUExecutionProvider\"])\n",
"\n",
"ef([\"text\"])\n"
],
"id": "d0e2356d4fbfaac6",
"outputs": [],
"execution_count": null
},
{
"metadata": {},
"cell_type": "code",
"source": "",
"id": "498277298d41c6f3",
"outputs": [],
"execution_count": null
}
],
"metadata": {
Expand Down

0 comments on commit fd5008b

Please sign in to comment.