Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Migrate from ggml-py to ggml-python, closes #1105

davidmezzetti4ce690d2256e
diff --git a/setup.py b/setup.py
index 9a91221e..eda7e30f 100644
--- a/setup.py
+++ b/setup.py
@@ -57,7 +57,7 @@ extras["agent"] = ["jinja2>=3.1.6", "mcpadapt>=0.1.0", "smolagents>=1.23"]
extras["ann"] = [
"annoy>=1.16.3",
"bitsandbytes>=0.42.0",
- "ggml-py>=0.9.4",
+ "ggml-python>=0.0.39",
"hnswlib>=0.5.0",
"pgvector>=0.4.1",
"scikit-learn>=0.23.1",
diff --git a/src/python/txtai/ann/dense/ggml.py b/src/python/txtai/ann/dense/ggml.py
index 34125d29..db4a693e 100644
--- a/src/python/txtai/ann/dense/ggml.py
+++ b/src/python/txtai/ann/dense/ggml.py
@@ -250,7 +250,8 @@ class GGMLTensors:
ggml.ggml_backend_graph_compute(self.backend, self.graph)
# Get size of embeddings data
- size = utils.get_shape(self.data)[1]
+ size = utils.get_shape(self.data)
+ size = size[1] if len(size) > 1 else 1
# Get and return results
results = np.zeros((batch.shape[0], size), dtype=np.float32)