Hadiil commited on
Commit
3691eca
·
verified ·
1 Parent(s): 29465a2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -14
Dockerfile CHANGED
@@ -23,26 +23,20 @@ ENV HF_HOME=/cache/huggingface
23
  ENV UPLOAD_DIR=/tmp/uploads
24
  ENV NLTK_DATA_DIR=/cache/nltk_data
25
  ENV PYTHONUNBUFFERED=1
 
26
 
27
- # Install dependencies
28
  COPY requirements.txt .
29
- RUN pip install --no-cache-dir -r requirements.txt
 
30
 
31
  # Pre-download NLTK punkt_tab
32
  RUN python -c "import nltk; nltk.download('punkt_tab', download_dir='/cache/nltk_data')"
33
 
34
- # Pre-download models
35
- RUN python -c "from transformers import AutoModel, AutoTokenizer, AutoProcessor, AutoModelForQuestionAnswering; \
36
- AutoModel.from_pretrained('sshleifer/distilbart-cnn-12-6'); \
37
- AutoTokenizer.from_pretrained('sshleifer/distilbart-cnn-12-6'); \
38
- AutoModel.from_pretrained('Salesforce/blip-image-captioning-large'); \
39
- AutoProcessor.from_pretrained('Salesforce/blip-image-captioning-large'); \
40
- AutoModel.from_pretrained('dandelin/vilt-b32-finetuned-vqa'); \
41
- AutoProcessor.from_pretrained('dandelin/vilt-b32-finetuned-vqa'); \
42
- AutoModelForQuestionAnswering.from_pretrained('distilbert-base-cased-distilled-squad'); \
43
- AutoTokenizer.from_pretrained('distilbert-base-cased-distilled-squad'); \
44
- AutoModel.from_pretrained('facebook/m2m100_418M'); \
45
- AutoTokenizer.from_pretrained('facebook/m2m100_418M')"
46
 
47
  # Copy application
48
  COPY . .
 
23
  ENV UPLOAD_DIR=/tmp/uploads
24
  ENV NLTK_DATA_DIR=/cache/nltk_data
25
  ENV PYTHONUNBUFFERED=1
26
+ ENV PYTHONPATH=/app
27
 
28
+ # Install Python dependencies
29
  COPY requirements.txt .
30
+ RUN pip install --no-cache-dir -r requirements.txt && \
31
+ pip install --no-cache-dir torchvision
32
 
33
  # Pre-download NLTK punkt_tab
34
  RUN python -c "import nltk; nltk.download('punkt_tab', download_dir='/cache/nltk_data')"
35
 
36
+ # Copy model download script
37
+ COPY download_models.py .
38
+ # Run model download with error handling
39
+ RUN python download_models.py
 
 
 
 
 
 
 
 
40
 
41
  # Copy application
42
  COPY . .