Spaces:
Sleeping
Sleeping
Commit ·
dd0fe1f
1
Parent(s): 560aa8b
fix: make model caching non-blocking to bypass huggingface auth errors
Browse files46 unmodified lines474849505152533 unmodified lines5758596061626346 unmodified linesfrom transformers import AutoTokenizer, AutoModelForSeq2SeqLM; \AutoTokenizer.from_pretrained('ai4bharat/indictrans2-en-indic-dist-200M', trust_remote_code=True, cache_dir='/app/models/indictrans2/en_to_indic'); \AutoModelForSeq2SeqLM.from_pretrained('ai4bharat/indictrans2-en-indic-dist-200M', trust_remote_code=True, cache_dir='/app/models/indictrans2/en_to_indic'); \print('✓ IndicTrans2 English→Indic model cached')"# ── Layer 5b: Pre-cache IndicTrans2 Indic→English model ──────# This is the REVERSE direction model (Sprint 18).3 unmodified linesfrom transformers import AutoTokenizer, AutoModelForSeq2SeqLM; \AutoTokenizer.from_pretrained('ai4bharat/indictrans2-indic-en-dist-200M', trust_remote_code=True, cache_dir='/app/models/indictrans2/indic_to_en'); \AutoModelForSeq2SeqLM.from_pretrained('ai4bharat/indictrans2-indic-en-dist-200M', trust_remote_code=True, cache_dir='/app/models/indictrans2/indic_to_en'); \print('✓ IndicTrans2 Indic→English model cached')"# ── Layer 6: Copy application code LAST ──────────────────────# Code changes don't invalidate the expensive model cache layers.46 unmodified lines474849505152533 unmodified lines5758596061626346 unmodified linesfrom transformers import AutoTokenizer, AutoModelForSeq2SeqLM; \AutoTokenizer.from_pretrained('ai4bharat/indictrans2-en-indic-dist-200M', trust_remote_code=True, cache_dir='/app/models/indictrans2/en_to_indic'); \AutoModelForSeq2SeqLM.from_pretrained('ai4bharat/indictrans2-en-indic-dist-200M', trust_remote_code=True, cache_dir='/app/models/indictrans2/en_to_indic'); \print('✓ IndicTrans2 English→Indic model cached')" || echo "⚠️ IndicTrans2 en-indic cache failed (non-blocking)"# ── Layer 5b: Pre-cache IndicTrans2 Indic→English model ──────# This is the REVERSE direction model (Sprint 18).3 unmodified linesfrom transformers import AutoTokenizer, AutoModelForSeq2SeqLM; \AutoTokenizer.from_pretrained('ai4bharat/indictrans2-indic-en-dist-200M', trust_remote_code=True, cache_dir='/app/models/indictrans2/indic_to_en'); \AutoModelForSeq2SeqLM.from_pretrained('ai4bharat/indictrans2-indic-en-dist-200M', trust_remote_code=True, cache_dir='/app/models/indictrans2/indic_to_en'); \print('✓ IndicTrans2 Indic→English model cached')" || echo "⚠️ IndicTrans2 indic-en cache failed (non-blocking)"# ── Layer 6: Copy application code LAST ──────────────────────# Code changes don't invalidate the expensive model cache layers.
Dockerfile+2-2