fix: Dockerfile + multi-path e5-base model lookup
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+6
-3
@@ -2,19 +2,22 @@ FROM python:3.11-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Python deps (no system deps needed)
|
||||
# Python deps (including sentence-transformers for local embedding)
|
||||
RUN pip install --no-cache-dir openpyxl typer pyyaml pydantic \
|
||||
faiss-cpu openai python-telegram-bot pymupdf Pillow
|
||||
faiss-cpu openai python-telegram-bot pymupdf Pillow \
|
||||
sentence-transformers rank-bm25
|
||||
|
||||
# App code
|
||||
COPY src/ src/
|
||||
COPY resources.json .
|
||||
COPY data/ data/
|
||||
|
||||
# FAISS index
|
||||
# FAISS indices
|
||||
COPY src/smeta_railway/ai/index/ src/smeta_railway/ai/index/
|
||||
|
||||
ENV PYTHONPATH=/app/src
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV HF_HUB_OFFLINE=1
|
||||
ENV TRANSFORMERS_OFFLINE=1
|
||||
|
||||
CMD ["python", "-m", "smeta_railway.ai.telegram_bot"]
|
||||
|
||||
@@ -14,7 +14,13 @@ import numpy as np
|
||||
|
||||
INDEX_DIR = Path(__file__).parent / "index"
|
||||
# Local model: multilingual-e5-base (free, 768 dim, 5/5 accuracy)
|
||||
E5_MODEL_PATH = str(Path.home() / ".cache/huggingface/hub/models--intfloat--multilingual-e5-base/snapshots/main")
|
||||
# Try multiple locations
|
||||
_E5_PATHS = [
|
||||
Path.home() / ".cache/huggingface/hub/models--intfloat--multilingual-e5-base/snapshots/main",
|
||||
Path.home() / "e5-base-model",
|
||||
Path("/app/e5-base-model"),
|
||||
]
|
||||
E5_MODEL_PATH = str(next((p for p in _E5_PATHS if p.exists()), _E5_PATHS[0]))
|
||||
EMBEDDING_DIM = 768
|
||||
|
||||
_model_cache = None
|
||||
|
||||
Reference in New Issue
Block a user