Spaces:
Runtime error
Runtime error
Peter Michael Gits Claude commited on
Commit ·
9f6a62e
1
Parent(s): 812a43d
Fix libgomp OMP_NUM_THREADS Invalid value error with explicit export
Browse filesv1.3.12 - Research-based fix for persistent libgomp warning:
- Root cause: OMP_NUM_THREADS getting set to empty string somewhere
- Solution: Explicit export in CMD: 'export OMP_NUM_THREADS=1 && python app.py'
- This ensures the variable is set to valid positive integer at runtime
- Based on libgomp documentation: requires positive integer, not empty string
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Dockerfile +5 -4
- app.py +1 -1
Dockerfile
CHANGED
|
@@ -43,8 +43,9 @@ RUN chown -R appuser:appuser /app
|
|
| 43 |
# Switch back to non-root user for running the app
|
| 44 |
USER appuser
|
| 45 |
|
| 46 |
-
# Set environment variables to fix OpenMP, CUDA memory, and caching issues
|
| 47 |
-
|
|
|
|
| 48 |
ENV PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
|
| 49 |
ENV CUDA_LAUNCH_BLOCKING=0
|
| 50 |
ENV HF_HOME=/app/hf_cache
|
|
@@ -58,5 +59,5 @@ EXPOSE 7860
|
|
| 58 |
HEALTHCHECK --interval=60s --timeout=45s --start-period=300s --retries=5 \
|
| 59 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 60 |
|
| 61 |
-
# Run application as non-root user
|
| 62 |
-
CMD ["
|
|
|
|
| 43 |
# Switch back to non-root user for running the app
|
| 44 |
USER appuser
|
| 45 |
|
| 46 |
+
# Set environment variables to fix OpenMP, CUDA memory, and caching issues
|
| 47 |
+
# Remove quotes and set as integer - libgomp requires positive integer, not empty string
|
| 48 |
+
ENV OMP_NUM_THREADS=1
|
| 49 |
ENV PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
|
| 50 |
ENV CUDA_LAUNCH_BLOCKING=0
|
| 51 |
ENV HF_HOME=/app/hf_cache
|
|
|
|
| 59 |
HEALTHCHECK --interval=60s --timeout=45s --start-period=300s --retries=5 \
|
| 60 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 61 |
|
| 62 |
+
# Run application as non-root user with explicit OMP_NUM_THREADS
|
| 63 |
+
CMD ["sh", "-c", "export OMP_NUM_THREADS=1 && python app.py"]
|
app.py
CHANGED
|
@@ -16,7 +16,7 @@ from fastapi.responses import JSONResponse, HTMLResponse
|
|
| 16 |
import uvicorn
|
| 17 |
|
| 18 |
# Version tracking
|
| 19 |
-
VERSION = "1.3.
|
| 20 |
COMMIT_SHA = "TBD"
|
| 21 |
|
| 22 |
# Configure logging
|
|
|
|
| 16 |
import uvicorn
|
| 17 |
|
| 18 |
# Version tracking
|
| 19 |
+
VERSION = "1.3.12"
|
| 20 |
COMMIT_SHA = "TBD"
|
| 21 |
|
| 22 |
# Configure logging
|