Tomtom84 commited on
Commit
d229a19
Β·
verified Β·
1 Parent(s): 11d76e7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +38 -39
Dockerfile CHANGED
@@ -1,62 +1,61 @@
1
- # PyTorch + CUDA 12.1 + cuDNN 8 (passt zur L4)
2
  FROM pytorch/pytorch:2.2.2-cuda12.1-cudnn8-runtime
3
 
4
- # -- System-Pakete minimal, aber was wir wirklich brauchen --
5
  RUN apt-get update && \
6
  apt-get install -y --no-install-recommends \
7
- git-lfs build-essential portaudio19-dev ffmpeg && \
 
 
 
 
 
 
8
  rm -rf /var/lib/apt/lists/*
9
 
10
- # Non-root-User (Spaces-Empfehlung)
11
  RUN useradd -m -u 1000 user
12
  USER user
13
  WORKDIR /app
 
 
14
  ENV PATH="/home/user/.local/bin:$PATH"
 
 
15
 
16
- # Orpheus-/SNAC-Code + Server
17
  COPY --chown=user . /app
18
 
19
- ENV HF_HOME=/app/.cache
20
- ENV VLLM_USE_LM_FORMAT_ENFORCER=0
21
- # GPU-freundliches Torch-Upgrade (falls gewΓΌnscht)
22
- #RUN pip install --no-cache-dir \
23
- # torch==2.3.1+cu121 torchaudio==2.3.1+cu121 \
24
- # --index-url https://download.pytorch.org/whl/cu121
25
 
26
- RUN pip install --no-cache-dir "transformers==4.40.2" "lm-format-enforcer==0.9.8"
27
- RUN pip install --no-cache-dir vllm>=0.9.0
 
 
 
28
 
29
- # Python-AbhΓ€ngigkeiten
30
  COPY --chown=user requirements.txt .
31
- RUN pip install --upgrade pip && \
32
- pip install --no-cache-dir -r requirements.txt
33
 
34
- RUN pip install --no-cache-dir "realtimetts[system]>=0.5.5"
 
35
 
36
- RUN pip install --no-cache-dir flashinfer-cu121-preview || echo "FlashInfer not available – continuing without."
37
-
38
- # nur *diese* Engine-Pflicht nachliefern, aber ohne Resolver:
39
- # RUN pip install --no-cache-dir pyttsx3==2.90 --no-deps
40
-
41
- # optional, um Warn-Spam zu reduzieren
42
- # RUN pip install --no-cache-dir azure-cognitiveservices-speech==1.33.0 --no-deps \
43
- # tqdm==4.66.1 --no-deps
44
 
 
45
  EXPOSE 7860
46
 
47
- # ───── Environment ───────────────────────────────────────
48
-
49
- ENV ORPHEUS_MODEL=SebastianBodza/Kartoffel_Orpheus-3B_german_synthetic-v0.1
50
- ENV MODEL_ID="SebastianBodza/Kartoffel_Orpheus-3B_german_synthetic-v0.1"
51
- ENV ORPHEUS_API_URL=http://127.0.0.1:1234
52
 
53
- # ───── Entrypoint ────────────────────────────────────────
54
- CMD bash -c "\
55
- python -m vllm.entrypoints.openai.api_server \
56
- --model ${MODEL_ID} \
57
- --port 1234 \
58
- --dtype bfloat16 \
59
- --gpu-memory-utilization 0.85 \
60
- --max-model-len 8192 & \
61
- uvicorn app:app --host 0.0.0.0 --port 7860"
62
 
 
 
 
1
+ # Use PyTorch with CUDA 12.1 for L4 GPU compatibility
2
  FROM pytorch/pytorch:2.2.2-cuda12.1-cudnn8-runtime
3
 
4
+ # Install system dependencies
5
  RUN apt-get update && \
6
  apt-get install -y --no-install-recommends \
7
+ git \
8
+ git-lfs \
9
+ build-essential \
10
+ portaudio19-dev \
11
+ ffmpeg \
12
+ curl \
13
+ wget && \
14
  rm -rf /var/lib/apt/lists/*
15
 
16
+ # Create non-root user for Hugging Face Spaces
17
  RUN useradd -m -u 1000 user
18
  USER user
19
  WORKDIR /app
20
+
21
+ # Set environment variables
22
  ENV PATH="/home/user/.local/bin:$PATH"
23
+ ENV HF_HOME=/app/.cache
24
+ ENV PYTHONPATH="/app:$PYTHONPATH"
25
 
26
+ # Copy application files
27
  COPY --chown=user . /app
28
 
29
+ # Upgrade pip and install Python dependencies
30
+ RUN pip install --upgrade pip
 
 
 
 
31
 
32
+ # Install core dependencies first
33
+ RUN pip install --no-cache-dir \
34
+ torch==2.2.2 \
35
+ transformers==4.40.2 \
36
+ vllm>=0.9.0
37
 
38
+ # Install requirements
39
  COPY --chown=user requirements.txt .
40
+ RUN pip install --no-cache-dir -r requirements.txt
 
41
 
42
+ # Install Orpheus TTS module
43
+ RUN pip install --no-cache-dir -e ./orpheus-tts
44
 
45
+ # Install additional optimizations for L4 GPU
46
+ RUN pip install --no-cache-dir flash-attn --no-build-isolation || echo "Flash attention not available, continuing..."
 
 
 
 
 
 
47
 
48
+ # Expose port for Hugging Face Spaces
49
  EXPOSE 7860
50
 
51
+ # Environment variables for the application
52
+ ENV PYTHONUNBUFFERED=1
53
+ ENV UVICORN_HOST=0.0.0.0
54
+ ENV UVICORN_PORT=7860
 
55
 
56
+ # Health check using FastAPI health endpoint
57
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=60s --retries=3 \
58
+ CMD curl -f http://localhost:7860/health || exit 1
 
 
 
 
 
 
59
 
60
+ # Start the FastAPI application with uvicorn
61
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]