Hameed13 commited on
Commit
9eb8f66
·
verified ·
1 Parent(s): d9f9a1e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -30
Dockerfile CHANGED
@@ -4,65 +4,60 @@ FROM python:3.10-slim
4
  # Set working directory
5
  WORKDIR /app
6
 
 
 
 
 
 
7
  # Install system dependencies
8
  RUN apt-get update && apt-get install -y \
9
  git \
10
  wget \
11
  curl \
12
  build-essential \
 
 
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
- # Install gdown for Google Drive downloads
16
- RUN pip install gdown
17
-
18
- # Copy requirements first to leverage Docker layer caching
19
- COPY requirements.txt .
20
-
21
  # Upgrade pip to latest version
22
  RUN pip install --upgrade pip
23
 
24
- # Install system dependencies for audio processing
25
- RUN apt-get update && apt-get install -y \
26
- git \
27
- wget \
28
- curl \
29
- build-essential \
30
- ffmpeg \
31
- libsndfile1 \
32
- && rm -rf /var/lib/apt/lists/*
33
-
34
  # Install gdown for Google Drive downloads
35
  RUN pip install gdown
36
 
37
- # Copy requirements first to leverage Docker layer caching
38
- COPY requirements.txt .
39
-
40
  # Install core dependencies first
41
  RUN pip install --no-cache-dir torch torchaudio --index-url https://download.pytorch.org/whl/cpu
42
 
43
- # Install other dependencies
 
44
  RUN pip install --no-cache-dir -r requirements.txt
45
 
46
  # Clone and install yarngpt
47
  RUN git clone https://github.com/saheedniyi02/yarngpt.git
48
  RUN cd yarngpt && pip install -e .
49
 
50
- # Download model files
51
- RUN wget https://huggingface.co/novateur/WavTokenizer-medium-speech-75token/resolve/main/wavtokenizer_mediumdata_frame75_3s_nq1_code4096_dim512_kmeans200_attn.yaml
52
- RUN gdown 1-ASeEkrn4HY49yZWHTASgfGFNXdVnLTt
 
 
 
 
 
 
 
53
 
54
  # Copy application code
55
  COPY . .
56
 
 
 
 
57
  # Create audio files directory
58
  RUN mkdir -p audio_files
59
 
60
- # Expose port
61
  EXPOSE 7860
62
 
63
- # Set environment variables
64
- ENV PYTHONPATH="${PYTHONPATH}:/app"
65
- ENV HF_HOME="/tmp/huggingface"
66
-
67
- # Run the application
68
- CMD ["python", "app.py"]
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
+ # Set environment variables
8
+ ENV PYTHONPATH="${PYTHONPATH}:/app"
9
+ ENV HF_HOME="/tmp/huggingface"
10
+ ENV PYTHONUNBUFFERED=1
11
+
12
  # Install system dependencies
13
  RUN apt-get update && apt-get install -y \
14
  git \
15
  wget \
16
  curl \
17
  build-essential \
18
+ ffmpeg \
19
+ libsndfile1 \
20
  && rm -rf /var/lib/apt/lists/*
21
 
 
 
 
 
 
 
22
  # Upgrade pip to latest version
23
  RUN pip install --upgrade pip
24
 
 
 
 
 
 
 
 
 
 
 
25
  # Install gdown for Google Drive downloads
26
  RUN pip install gdown
27
 
 
 
 
28
  # Install core dependencies first
29
  RUN pip install --no-cache-dir torch torchaudio --index-url https://download.pytorch.org/whl/cpu
30
 
31
+ # Copy requirements and install Python dependencies
32
+ COPY requirements.txt .
33
  RUN pip install --no-cache-dir -r requirements.txt
34
 
35
  # Clone and install yarngpt
36
  RUN git clone https://github.com/saheedniyi02/yarngpt.git
37
  RUN cd yarngpt && pip install -e .
38
 
39
+ # Download model files with better error handling
40
+ RUN echo "Downloading config file..." && \
41
+ wget -v -O wavtokenizer_mediumdata_frame75_3s_nq1_code4096_dim512_kmeans200_attn.yaml \
42
+ https://huggingface.co/novateur/WavTokenizer-medium-speech-75token/resolve/main/wavtokenizer_mediumdata_frame75_3s_nq1_code4096_dim512_kmeans200_attn.yaml
43
+
44
+ RUN echo "Downloading model checkpoint..." && \
45
+ gdown --id 1-ASeEkrn4HY49yZWHTASgfGFNXdVnLTt -O wavtokenizer_large_speech_320_24k.ckpt
46
+
47
+ # Verify files were downloaded
48
+ RUN ls -la *.yaml *.ckpt
49
 
50
  # Copy application code
51
  COPY . .
52
 
53
+ # Make startup script executable
54
+ RUN chmod +x start.sh
55
+
56
  # Create audio files directory
57
  RUN mkdir -p audio_files
58
 
59
+ # Expose port 7860 (required by Hugging Face Spaces)
60
  EXPOSE 7860
61
 
62
+ # Run the application with startup script
63
+ CMD ["./start.sh"]