robrtt commited on
Commit
d320d00
Β·
1 Parent(s): afb4b47

Clean rebuild: all features fixed

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -8
Dockerfile CHANGED
@@ -24,11 +24,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
24
 
25
  WORKDIR /app
26
 
27
- # ── Pin numpy FIRST β€” must be before torch and all other packages ──
28
- # numpy==1.26.4 required by torch 2.1.0, transformers 4.35.2, chromadb 0.5.3
29
- # HF environment has numpy 2.x which breaks these; pin here to lock it early
30
- RUN pip install --no-cache-dir "numpy==1.26.4"
31
-
32
  # ── Install PyTorch CPU ──────────────────────────────────────
33
  RUN pip install --no-cache-dir \
34
  torch==2.1.0+cpu \
@@ -45,9 +40,6 @@ COPY cv_module/requirements.txt /tmp/cv-requirements.txt
45
  RUN sed -i '/^torch==/d; /^torchvision==/d; /^numpy==/d' /tmp/cv-requirements.txt && \
46
  pip install --no-cache-dir -r /tmp/cv-requirements.txt
47
 
48
- # ── Re-pin numpy after CV deps (open-clip-torch upgrades it) ────
49
- RUN pip install --no-cache-dir --force-reinstall "numpy==1.26.4"
50
-
51
  # ── YOLO ONNX export at build time ──────────────────────────
52
  COPY scripts/export_yolo_onnx.py /tmp/export_yolo_onnx.py
53
  RUN mkdir -p /app/cv/model_cache && \
@@ -56,6 +48,19 @@ RUN mkdir -p /app/cv/model_cache && \
56
  pip uninstall -y ultralytics && \
57
  rm -f yolov8n.pt yolov8n.onnx /tmp/export_yolo_onnx.py
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  # ── Patch chromadb DefaultEmbeddingFunction ──────────────────
60
  COPY scripts/patch_libs.py /tmp/patch_libs.py
61
  RUN python /tmp/patch_libs.py || echo "patches finished with warnings"
 
24
 
25
  WORKDIR /app
26
 
 
 
 
 
 
27
  # ── Install PyTorch CPU ──────────────────────────────────────
28
  RUN pip install --no-cache-dir \
29
  torch==2.1.0+cpu \
 
40
  RUN sed -i '/^torch==/d; /^torchvision==/d; /^numpy==/d' /tmp/cv-requirements.txt && \
41
  pip install --no-cache-dir -r /tmp/cv-requirements.txt
42
 
 
 
 
43
  # ── YOLO ONNX export at build time ──────────────────────────
44
  COPY scripts/export_yolo_onnx.py /tmp/export_yolo_onnx.py
45
  RUN mkdir -p /app/cv/model_cache && \
 
48
  pip uninstall -y ultralytics && \
49
  rm -f yolov8n.pt yolov8n.onnx /tmp/export_yolo_onnx.py
50
 
51
+ # ── Patch chromadb for numpy 2.x compatibility ───────────────
52
+ # chromadb 0.5.3 uses np.float_, np.int_, np.uint which were removed in numpy 2.0
53
+ # Patch the source directly since we can't pin numpy (other deps force numpy 2.x)
54
+ RUN python -c "
55
+ import pathlib, re
56
+ p = pathlib.Path('/usr/local/lib/python3.10/site-packages/chromadb/api/types.py')
57
+ if p.exists():
58
+ t = p.read_text()
59
+ t = t.replace('np.uint, np.int_, np.float_', 'np.unsignedinteger, np.signedinteger, np.float64')
60
+ p.write_text(t)
61
+ print('chromadb types.py patched for numpy 2.x')
62
+ "
63
+
64
  # ── Patch chromadb DefaultEmbeddingFunction ──────────────────
65
  COPY scripts/patch_libs.py /tmp/patch_libs.py
66
  RUN python /tmp/patch_libs.py || echo "patches finished with warnings"