Clean rebuild: all features fixed
Browse files- Dockerfile +2 -11
- scripts/patch_chromadb_numpy2.py +19 -0
Dockerfile
CHANGED
|
@@ -49,17 +49,8 @@ RUN mkdir -p /app/cv/model_cache && \
|
|
| 49 |
rm -f yolov8n.pt yolov8n.onnx /tmp/export_yolo_onnx.py
|
| 50 |
|
| 51 |
# ββ Patch chromadb for numpy 2.x compatibility βββββββββββββββ
|
| 52 |
-
|
| 53 |
-
|
| 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
|
|
|
|
| 49 |
rm -f yolov8n.pt yolov8n.onnx /tmp/export_yolo_onnx.py
|
| 50 |
|
| 51 |
# ββ Patch chromadb for numpy 2.x compatibility βββββββββββββββ
|
| 52 |
+
COPY scripts/patch_chromadb_numpy2.py /tmp/patch_chromadb_numpy2.py
|
| 53 |
+
RUN python /tmp/patch_chromadb_numpy2.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
# ββ Patch chromadb DefaultEmbeddingFunction ββββββββββββββββββ
|
| 56 |
COPY scripts/patch_libs.py /tmp/patch_libs.py
|
scripts/patch_chromadb_numpy2.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Patch chromadb 0.5.3 untuk kompatibilitas numpy 2.x."""
|
| 2 |
+
import pathlib, sys
|
| 3 |
+
|
| 4 |
+
p = pathlib.Path('/usr/local/lib/python3.10/site-packages/chromadb/api/types.py')
|
| 5 |
+
if not p.exists():
|
| 6 |
+
print("[patch] chromadb/api/types.py tidak ditemukan, skip")
|
| 7 |
+
sys.exit(0)
|
| 8 |
+
|
| 9 |
+
txt = p.read_text()
|
| 10 |
+
if 'np.float64' in txt and 'np.float_' not in txt:
|
| 11 |
+
print("[patch] sudah di-patch, skip")
|
| 12 |
+
sys.exit(0)
|
| 13 |
+
|
| 14 |
+
txt = txt.replace(
|
| 15 |
+
'np.uint, np.int_, np.float_',
|
| 16 |
+
'np.unsignedinteger, np.signedinteger, np.float64'
|
| 17 |
+
)
|
| 18 |
+
p.write_text(txt)
|
| 19 |
+
print(f"[patch] chromadb/api/types.py patched for numpy 2.x: {p}")
|