Spaces:
Sleeping
Sleeping
thadillo Claude commited on
Commit ·
434e8da
1
Parent(s): 2ccb2e4
Pre-download all models: BART, DeBERTa, DistilBART
Browse filesModels now pre-downloaded in container image:
- Zero-shot models:
* facebook/bart-large-mnli (~1.6GB)
* MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli (~350MB)
* valhalla/distilbart-mnli-12-3 (~500MB)
- Fine-tuning models (tokenizers only):
* microsoft/deberta-v3-small (~50MB)
* microsoft/deberta-v3-base (~100MB)
Total container image: ~4-5GB
/data storage: Only DB + user-trained models (<5GB)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Dockerfile +12 -2
Dockerfile
CHANGED
|
@@ -29,10 +29,20 @@ RUN mkdir -p /data/.cache/huggingface && chmod -R 777 /data/.cache
|
|
| 29 |
# Create model cache in container (not in /data) to save persistent storage
|
| 30 |
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
|
| 31 |
|
| 32 |
-
# Pre-download
|
| 33 |
ENV HF_HOME=/app/.cache/huggingface
|
| 34 |
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
# Hugging Face Spaces uses port 7860
|
| 38 |
EXPOSE 7860
|
|
|
|
| 29 |
# Create model cache in container (not in /data) to save persistent storage
|
| 30 |
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
|
| 31 |
|
| 32 |
+
# Pre-download models into container image to avoid using /data storage
|
| 33 |
ENV HF_HOME=/app/.cache/huggingface
|
| 34 |
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
|
| 35 |
+
|
| 36 |
+
# Download zero-shot models (for analysis)
|
| 37 |
+
RUN python -c "from transformers import pipeline; \
|
| 38 |
+
pipeline('zero-shot-classification', model='facebook/bart-large-mnli', device=-1); \
|
| 39 |
+
pipeline('zero-shot-classification', model='MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli', device=-1); \
|
| 40 |
+
pipeline('zero-shot-classification', model='valhalla/distilbart-mnli-12-3', device=-1)"
|
| 41 |
+
|
| 42 |
+
# Download common fine-tuning models
|
| 43 |
+
RUN python -c "from transformers import AutoModelForSequenceClassification, AutoTokenizer; \
|
| 44 |
+
AutoTokenizer.from_pretrained('microsoft/deberta-v3-small'); \
|
| 45 |
+
AutoTokenizer.from_pretrained('microsoft/deberta-v3-base')"
|
| 46 |
|
| 47 |
# Hugging Face Spaces uses port 7860
|
| 48 |
EXPOSE 7860
|