Spaces:
Sleeping
Sleeping
Commit ·
560aa8b
1
Parent(s): 1c40719
fix: resolve python syntax error in Dockerfile try/except blocks
Browse files- Dockerfile +8 -14
Dockerfile
CHANGED
|
@@ -44,26 +44,20 @@ print('✓ Ettin Reranker cached')"
|
|
| 44 |
# This is the English→Indic direction model (Sprint 18).
|
| 45 |
# Required for local translation of English responses back to user's language.
|
| 46 |
RUN python -c "\
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
print('✓ IndicTrans2 English→Indic model cached'); \
|
| 52 |
-
except Exception as e: \
|
| 53 |
-
print(f'⚠️ IndicTrans2 en-indic cache failed (non-blocking): {e}')"
|
| 54 |
|
| 55 |
# ── Layer 5b: Pre-cache IndicTrans2 Indic→English model ──────
|
| 56 |
# This is the REVERSE direction model (Sprint 18).
|
| 57 |
# Required for local translation of Hindi/Tamil queries INTO English
|
| 58 |
# before semantic search against the English vector corpus.
|
| 59 |
RUN python -c "\
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
print('✓ IndicTrans2 Indic→English model cached'); \
|
| 65 |
-
except Exception as e: \
|
| 66 |
-
print(f'⚠️ IndicTrans2 indic-en cache failed (non-blocking): {e}')"
|
| 67 |
|
| 68 |
# ── Layer 6: Copy application code LAST ──────────────────────
|
| 69 |
# Code changes don't invalidate the expensive model cache layers.
|
|
|
|
| 44 |
# This is the English→Indic direction model (Sprint 18).
|
| 45 |
# Required for local translation of English responses back to user's language.
|
| 46 |
RUN python -c "\
|
| 47 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM; \
|
| 48 |
+
AutoTokenizer.from_pretrained('ai4bharat/indictrans2-en-indic-dist-200M', trust_remote_code=True, cache_dir='/app/models/indictrans2/en_to_indic'); \
|
| 49 |
+
AutoModelForSeq2SeqLM.from_pretrained('ai4bharat/indictrans2-en-indic-dist-200M', trust_remote_code=True, cache_dir='/app/models/indictrans2/en_to_indic'); \
|
| 50 |
+
print('✓ IndicTrans2 English→Indic model cached')"
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
# ── Layer 5b: Pre-cache IndicTrans2 Indic→English model ──────
|
| 53 |
# This is the REVERSE direction model (Sprint 18).
|
| 54 |
# Required for local translation of Hindi/Tamil queries INTO English
|
| 55 |
# before semantic search against the English vector corpus.
|
| 56 |
RUN python -c "\
|
| 57 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM; \
|
| 58 |
+
AutoTokenizer.from_pretrained('ai4bharat/indictrans2-indic-en-dist-200M', trust_remote_code=True, cache_dir='/app/models/indictrans2/indic_to_en'); \
|
| 59 |
+
AutoModelForSeq2SeqLM.from_pretrained('ai4bharat/indictrans2-indic-en-dist-200M', trust_remote_code=True, cache_dir='/app/models/indictrans2/indic_to_en'); \
|
| 60 |
+
print('✓ IndicTrans2 Indic→English model cached')"
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
# ── Layer 6: Copy application code LAST ──────────────────────
|
| 63 |
# Code changes don't invalidate the expensive model cache layers.
|