Spaces:
Sleeping
Sleeping
feat: ModernBERT architecture incompatibility chain fix and gitignore cleanup
Browse files
Dockerfile
CHANGED
|
@@ -30,15 +30,20 @@ RUN pip install --no-cache-dir \
|
|
| 30 |
COPY requirements.txt .
|
| 31 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 32 |
|
| 33 |
-
# ββ Layer
|
| 34 |
-
#
|
| 35 |
-
# Models are cached to /app/models (persisted across container restarts).
|
| 36 |
RUN python -c "\
|
| 37 |
-
from sentence_transformers import SentenceTransformer
|
| 38 |
SentenceTransformer('nomic-ai/nomic-embed-text-v1', cache_folder='/app/models', trust_remote_code=True); \
|
| 39 |
-
print('β Nomic Embedding model (768-dim) cached')
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
# ββ Layer 5a: Pre-cache IndicTrans2 EnglishβIndic model ββββββ
|
| 44 |
# This is the EnglishβIndic direction model (Sprint 18).
|
|
|
|
| 30 |
COPY requirements.txt .
|
| 31 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 32 |
|
| 33 |
+
# ββ Layer 4a: Pre-cache Nomic Embedding model ββββββββββββββββ
|
| 34 |
+
# Separated from reranker to prevent one failure from blocking the other.
|
|
|
|
| 35 |
RUN python -c "\
|
| 36 |
+
from sentence_transformers import SentenceTransformer; \
|
| 37 |
SentenceTransformer('nomic-ai/nomic-embed-text-v1', cache_folder='/app/models', trust_remote_code=True); \
|
| 38 |
+
print('β Nomic Embedding model (768-dim) cached')"
|
| 39 |
+
|
| 40 |
+
# ββ Layer 4b: Pre-cache Ettin Reranker (ModernBERT) ββββββββββ
|
| 41 |
+
# CRITICAL FIX: trust_remote_code=True is MANDATORY for ModernBERT architecture.
|
| 42 |
+
# Without it: KeyError: 'modernbert' β build crash.
|
| 43 |
+
RUN python -c "\
|
| 44 |
+
from sentence_transformers import CrossEncoder; \
|
| 45 |
+
CrossEncoder('cross-encoder/ettin-reranker-68m-v1', max_length=512, trust_remote_code=True); \
|
| 46 |
+
print('β Ettin Reranker (ModernBERT) cached')"
|
| 47 |
|
| 48 |
# ββ Layer 5a: Pre-cache IndicTrans2 EnglishβIndic model ββββββ
|
| 49 |
# This is the EnglishβIndic direction model (Sprint 18).
|
api.py
CHANGED
|
@@ -115,7 +115,7 @@ def get_reranker_model():
|
|
| 115 |
global reranker_model
|
| 116 |
if reranker_model is None:
|
| 117 |
print("β³ Loading Cross-Encoder Reranker Model...")
|
| 118 |
-
reranker_model = CrossEncoder('cross-encoder/ettin-reranker-68m-v1', max_length=512, device='cpu')
|
| 119 |
print("β
Reranker Model loaded")
|
| 120 |
return reranker_model
|
| 121 |
|
|
|
|
| 115 |
global reranker_model
|
| 116 |
if reranker_model is None:
|
| 117 |
print("β³ Loading Cross-Encoder Reranker Model...")
|
| 118 |
+
reranker_model = CrossEncoder('cross-encoder/ettin-reranker-68m-v1', max_length=512, device='cpu', trust_remote_code=True)
|
| 119 |
print("β
Reranker Model loaded")
|
| 120 |
return reranker_model
|
| 121 |
|
eligibility/__pycache__/__init__.cpython-312.pyc
DELETED
|
Binary file (154 Bytes)
|
|
|
eligibility/__pycache__/engine.cpython-312.pyc
DELETED
|
Binary file (2.79 kB)
|
|
|
eligibility/__pycache__/entities.cpython-312.pyc
DELETED
|
Binary file (551 Bytes)
|
|
|
eligibility/__pycache__/variables.cpython-312.pyc
DELETED
|
Binary file (10.8 kB)
|
|
|
requirements.txt
CHANGED
|
@@ -11,7 +11,7 @@ uvicorn[standard]
|
|
| 11 |
# --- ML / AI (CPU-ONLY WHEELS) ---
|
| 12 |
# CRITICAL: --extra-index-url in Dockerfile forces CPU torch
|
| 13 |
# DO NOT add torch here β it is installed separately in Dockerfile Layer 2
|
| 14 |
-
sentence-transformers>=
|
| 15 |
einops
|
| 16 |
huggingface-hub
|
| 17 |
|
|
|
|
| 11 |
# --- ML / AI (CPU-ONLY WHEELS) ---
|
| 12 |
# CRITICAL: --extra-index-url in Dockerfile forces CPU torch
|
| 13 |
# DO NOT add torch here β it is installed separately in Dockerfile Layer 2
|
| 14 |
+
sentence-transformers>=4.0.0
|
| 15 |
einops
|
| 16 |
huggingface-hub
|
| 17 |
|