Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +12 -10
Dockerfile
CHANGED
|
@@ -1,24 +1,26 @@
|
|
| 1 |
|
| 2 |
-
# Use the official Hugging Face Docker image
|
| 3 |
FROM huggingface/transformers-pytorch-gpu:latest
|
| 4 |
|
| 5 |
-
# Install
|
| 6 |
RUN pip install --no-cache-dir \
|
| 7 |
gradio \
|
| 8 |
torch \
|
| 9 |
transformers \
|
| 10 |
sentencepiece \
|
| 11 |
-
accelerate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
# Create working directory
|
| 14 |
WORKDIR /app
|
| 15 |
COPY . /app
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
# RUN python
|
| 19 |
-
|
| 20 |
-
# Expose port
|
| 21 |
-
EXPOSE 7860
|
| 22 |
|
| 23 |
-
# Run the application
|
| 24 |
CMD ["python", "app.py"]
|
|
|
|
| 1 |
|
|
|
|
| 2 |
FROM huggingface/transformers-pytorch-gpu:latest
|
| 3 |
|
| 4 |
+
# Install with backoff-retry for robustness
|
| 5 |
RUN pip install --no-cache-dir \
|
| 6 |
gradio \
|
| 7 |
torch \
|
| 8 |
transformers \
|
| 9 |
sentencepiece \
|
| 10 |
+
accelerate \
|
| 11 |
+
huggingface-hub \
|
| 12 |
+
datasets \
|
| 13 |
+
tenacity # For retry logic
|
| 14 |
+
|
| 15 |
+
# Configure cache
|
| 16 |
+
ENV TRANSFORMERS_CACHE="/cache/models"
|
| 17 |
+
ENV HF_DATASETS_CACHE="/cache/datasets"
|
| 18 |
+
RUN mkdir -p /cache/models /cache/datasets
|
| 19 |
|
|
|
|
| 20 |
WORKDIR /app
|
| 21 |
COPY . /app
|
| 22 |
|
| 23 |
+
# Pre-cache during build (optional)
|
| 24 |
+
# RUN python cache_to_repo.py
|
|
|
|
|
|
|
|
|
|
| 25 |
|
|
|
|
| 26 |
CMD ["python", "app.py"]
|