Spaces:
Running
Running
fix: reduce vector index resource
Browse files- Dockerfile +1 -2
- redis.conf +1 -1
- src/constants.py +2 -2
Dockerfile
CHANGED
|
@@ -15,10 +15,9 @@ COPY redis.conf .
|
|
| 15 |
ENV REDIS_HOST=localhost
|
| 16 |
ENV REDIS_PORT=6379
|
| 17 |
|
|
|
|
| 18 |
ENV TRANSFORMERS_CACHE=/tmp/.cache/huggingface/transformers
|
| 19 |
ENV HF_HOME=/tmp/.cache/huggingface
|
| 20 |
ENV SENTENCE_TRANSFORMERS_HOME=/tmp/.cache/sentence_transformers
|
| 21 |
|
| 22 |
-
COPY ./src ./src
|
| 23 |
-
|
| 24 |
CMD ["sh", "-c", "redis-server redis.conf & python3 src/app.py"]
|
|
|
|
| 15 |
ENV REDIS_HOST=localhost
|
| 16 |
ENV REDIS_PORT=6379
|
| 17 |
|
| 18 |
+
COPY ./src ./src
|
| 19 |
ENV TRANSFORMERS_CACHE=/tmp/.cache/huggingface/transformers
|
| 20 |
ENV HF_HOME=/tmp/.cache/huggingface
|
| 21 |
ENV SENTENCE_TRANSFORMERS_HOME=/tmp/.cache/sentence_transformers
|
| 22 |
|
|
|
|
|
|
|
| 23 |
CMD ["sh", "-c", "redis-server redis.conf & python3 src/app.py"]
|
redis.conf
CHANGED
|
@@ -2,4 +2,4 @@ loadmodule /opt/redis-stack/lib/redisearch.so
|
|
| 2 |
|
| 3 |
maxmemory 768mb
|
| 4 |
|
| 5 |
-
dir /
|
|
|
|
| 2 |
|
| 3 |
maxmemory 768mb
|
| 4 |
|
| 5 |
+
dir /tmp
|
src/constants.py
CHANGED
|
@@ -13,10 +13,10 @@ HNSW_PARAMETERS = {
|
|
| 13 |
# Defines the initial capacity of the vector index. It helps in pre-allocating space for the index.
|
| 14 |
"INITIAL_CAP": 440,
|
| 15 |
# Max number of outgoing edges (connections) for each node in a graph layer.
|
| 16 |
-
"M":
|
| 17 |
# Max number of connected neighbors to consider during graph building.
|
| 18 |
# Higher values increase accuracy, but also increase index build time.
|
| 19 |
-
"EF_CONSTRUCTION":
|
| 20 |
# Max top candidates during KNN search. Higher values increase accuracy, but also increase search latency.
|
| 21 |
"EF_RUNTIME": 10,
|
| 22 |
}
|
|
|
|
| 13 |
# Defines the initial capacity of the vector index. It helps in pre-allocating space for the index.
|
| 14 |
"INITIAL_CAP": 440,
|
| 15 |
# Max number of outgoing edges (connections) for each node in a graph layer.
|
| 16 |
+
"M": 16,
|
| 17 |
# Max number of connected neighbors to consider during graph building.
|
| 18 |
# Higher values increase accuracy, but also increase index build time.
|
| 19 |
+
"EF_CONSTRUCTION": 256,
|
| 20 |
# Max top candidates during KNN search. Higher values increase accuracy, but also increase search latency.
|
| 21 |
"EF_RUNTIME": 10,
|
| 22 |
}
|