Spaces:
Runtime error
Runtime error
Peter Michael Gits Claude commited on
Commit ·
049566b
1
Parent(s): d764d2b
Fix OMP_NUM_THREADS warning and restart loop issues
Browse filesv1.3.10 - Final fixes for clean startup:
1. Moved OMP_NUM_THREADS=1 to Dockerfile ENV (not Python os.environ)
2. Moved all HF cache environment variables to Dockerfile ENV
3. Extended health check timing: 300s start period, 60s interval, 5 retries
(allows more time for Moshi model loading without failing health checks)
4. Cleaned up Python environment variable setting code
Should eliminate both libgomp warning and restart loops
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Files changed (2)
- Dockerfile+8-2
- app.py+3-8
42 unmodified lines434445464748495051525342 unmodified lines# Switch back to non-root user for running the appUSER appuser# Expose portEXPOSE 7860# Health checkHEALTHCHECK --interval=30s --timeout=30s --start-period=180s --retries=3 \CMD curl -f http://localhost:7860/health || exit 1# Run application as non-root user42 unmodified lines434445464748495051525354555657585942 unmodified lines# Switch back to non-root user for running the appUSER appuser# Set environment variables to fix OpenMP and caching issuesENV OMP_NUM_THREADS=1ENV HF_HOME=/app/hf_cacheENV HUGGINGFACE_HUB_CACHE=/app/hf_cacheENV TRANSFORMERS_CACHE=/app/hf_cache# Expose portEXPOSE 7860# Health check - allow more time for model loadingHEALTHCHECK --interval=60s --timeout=45s --start-period=300s --retries=5 \CMD curl -f http://localhost:7860/health || exit 1# Run application as non-root user
5 unmodified lines67891011121314151617182 unmodified lines212223242526275 unmodified linesfrom typing import Optionalfrom contextlib import asynccontextmanager# Fix OpenMP warning - MUST be set before importing torchos.environ['OMP_NUM_THREADS'] = '1'# Fix cache directory permissions - set to writable directoryos.environ['HF_HOME'] = '/app/hf_cache'os.environ['HUGGINGFACE_HUB_CACHE'] = '/app/hf_cache'os.environ['TRANSFORMERS_CACHE'] = '/app/hf_cache'import torchimport numpy as np2 unmodified linesimport uvicorn# Version trackingVERSION = "1.3.9"COMMIT_SHA = "TBD"# Configure logging5 unmodified lines6789101112132 unmodified lines161718192021225 unmodified linesfrom typing import Optionalfrom contextlib import asynccontextmanager# Environment variables now set in Dockerfile# OMP_NUM_THREADS=1, HF_HOME=/app/hf_cache, etc.import torchimport numpy as np2 unmodified linesimport uvicorn# Version trackingVERSION = "1.3.10"COMMIT_SHA = "TBD"# Configure logging
Dockerfile+8-2
app.py+3-8