Always use CPU for searching

This commit is contained in:
Nicolas Mowen 2024-09-17 12:23:18 -06:00
parent 9ab6bf0603
commit 514716807a
3 changed files with 37 additions and 3 deletions

View File

@ -1,3 +1,32 @@
# Embeddings
chromadb == 0.5.0
onnx_clip == 4.0.*
# chromadb dependencies
bcrypt>=4.0.1
chroma-hnswlib==0.7.6
fastapi>=0.95.2
graphlib_backport==1.0.3; python_version < '3.9'
grpcio>=1.58.0
httpx>=0.27.0
importlib-resources
kubernetes>=28.1.0
mmh3>=4.0.1
numpy>=1.22.5, <2.0.0
opentelemetry-api>=1.2.0
opentelemetry-exporter-otlp-proto-grpc>=1.24.0
opentelemetry-instrumentation-fastapi>=0.41b0
opentelemetry-sdk>=1.2.0
orjson>=3.9.12, < 3.10.6 # 3.10.7 is currently missing a wheel for x86 glibc
overrides>=7.3.1
posthog>=2.4.0
pydantic>=1.9
pypika>=0.48.9
PyYAML>=6.0.0
rich>=10.11.0
tenacity>=8.2.3
tokenizers>=0.13.2
tqdm>=4.65.0
typer>=0.9.0
typing_extensions>=4.5.0
uvicorn[standard]>=0.18.3

View File

@ -85,7 +85,10 @@ class Embeddings:
@property
def description(self) -> Collection:
return self.client.get_or_create_collection(
name="event_description", embedding_function=MiniLMEmbedding()
name="event_description",
embedding_function=MiniLMEmbedding(
preferred_providers=["CPUExecutionProvider"]
),
)
def reindex(self) -> None:

View File

@ -69,7 +69,9 @@ class Clip(OnnxClip):
try:
if os.path.exists(path):
return ort.InferenceSession(path, providers=providers, options=options)
return ort.InferenceSession(
path, providers=providers, provider_options=options
)
else:
raise FileNotFoundError(
errno.ENOENT,
@ -101,7 +103,7 @@ class Clip(OnnxClip):
# Finally move the temporary file to the correct location
temporary_filename.rename(path)
return ort.InferenceSession(
path, providers=provider, provider_options=optionsm
path, providers=provider, provider_options=options
)