Spaces:
Runtime error
Runtime error
Peter Michael Gits Claude commited on
Commit ·
7ea77be
1
Parent(s): b9decdb
Fix build errors: Update dependencies and Docker configuration
Browse files- Fix moshi package installation (remove non-existent version pin)
- Update PyTorch to compatible version 2.4.0
- Simplify Dockerfile with python:3.10-slim base image
- Remove unnecessary system dependencies
- Add datasets dependency for transformers compatibility
Resolves build error in HuggingFace Space deployment
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Dockerfile +5 -11
- requirements.txt +5 -4
Dockerfile
CHANGED
|
@@ -1,19 +1,13 @@
|
|
| 1 |
-
FROM
|
| 2 |
|
| 3 |
# Set environment variables
|
| 4 |
-
ENV DEBIAN_FRONTEND=noninteractive
|
| 5 |
ENV PYTHONUNBUFFERED=1
|
| 6 |
ENV TRANSFORMERS_CACHE=/app/model_cache
|
| 7 |
ENV HF_HOME=/app/model_cache
|
| 8 |
|
| 9 |
# Install system dependencies
|
| 10 |
RUN apt-get update && apt-get install -y \
|
| 11 |
-
python3 \
|
| 12 |
-
python3-pip \
|
| 13 |
-
python3-dev \
|
| 14 |
ffmpeg \
|
| 15 |
-
portaudio19-dev \
|
| 16 |
-
libasound2-dev \
|
| 17 |
libsndfile1 \
|
| 18 |
git \
|
| 19 |
curl \
|
|
@@ -27,11 +21,11 @@ RUN mkdir -p /app/model_cache
|
|
| 27 |
COPY requirements.txt .
|
| 28 |
|
| 29 |
# Install Python dependencies
|
| 30 |
-
RUN
|
| 31 |
-
RUN
|
| 32 |
|
| 33 |
# Pre-download and cache the model during build
|
| 34 |
-
RUN
|
| 35 |
import os
|
| 36 |
os.environ['TRANSFORMERS_CACHE'] = '/app/model_cache'
|
| 37 |
os.environ['HF_HOME'] = '/app/model_cache'
|
|
@@ -61,4 +55,4 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
|
| 61 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 62 |
|
| 63 |
# Run the application
|
| 64 |
-
CMD ["
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
|
| 3 |
# Set environment variables
|
|
|
|
| 4 |
ENV PYTHONUNBUFFERED=1
|
| 5 |
ENV TRANSFORMERS_CACHE=/app/model_cache
|
| 6 |
ENV HF_HOME=/app/model_cache
|
| 7 |
|
| 8 |
# Install system dependencies
|
| 9 |
RUN apt-get update && apt-get install -y \
|
|
|
|
|
|
|
|
|
|
| 10 |
ffmpeg \
|
|
|
|
|
|
|
| 11 |
libsndfile1 \
|
| 12 |
git \
|
| 13 |
curl \
|
|
|
|
| 21 |
COPY requirements.txt .
|
| 22 |
|
| 23 |
# Install Python dependencies
|
| 24 |
+
RUN pip install --no-cache-dir --upgrade pip
|
| 25 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 26 |
|
| 27 |
# Pre-download and cache the model during build
|
| 28 |
+
RUN python -c "
|
| 29 |
import os
|
| 30 |
os.environ['TRANSFORMERS_CACHE'] = '/app/model_cache'
|
| 31 |
os.environ['HF_HOME'] = '/app/model_cache'
|
|
|
|
| 55 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 56 |
|
| 57 |
# Run the application
|
| 58 |
+
CMD ["python", "app.py"]
|
requirements.txt
CHANGED
|
@@ -2,11 +2,12 @@ fastapi==0.104.1
|
|
| 2 |
uvicorn[standard]==0.24.0
|
| 3 |
websockets==12.0
|
| 4 |
transformers==4.36.0
|
| 5 |
-
torch==2.
|
| 6 |
-
torchaudio==2.
|
| 7 |
librosa==0.10.1
|
| 8 |
numpy==1.24.0
|
| 9 |
-
moshi
|
| 10 |
accelerate==0.24.1
|
| 11 |
safetensors==0.4.1
|
| 12 |
-
python-multipart==0.0.6
|
|
|
|
|
|
| 2 |
uvicorn[standard]==0.24.0
|
| 3 |
websockets==12.0
|
| 4 |
transformers==4.36.0
|
| 5 |
+
torch==2.4.0
|
| 6 |
+
torchaudio==2.4.0
|
| 7 |
librosa==0.10.1
|
| 8 |
numpy==1.24.0
|
| 9 |
+
moshi
|
| 10 |
accelerate==0.24.1
|
| 11 |
safetensors==0.4.1
|
| 12 |
+
python-multipart==0.0.6
|
| 13 |
+
datasets==2.14.5
|