File size: 1,446 Bytes
321ff82
7af0b69
 
f3a868a
7af0b69
 
7397a7d
7af0b69
f3a868a
 
7af0b69
f3a868a
 
 
 
 
 
3aed552
f3a868a
 
321ff82
f3a868a
 
 
 
 
 
 
 
 
 
 
 
7af0b69
5169683
 
f3a868a
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
FROM python:3.9-slim

RUN apt-get update && apt-get install -y \
    ffmpeg git cmake build-essential \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# 1. Tải mã nguồn về máy ảo
RUN git clone --depth 1 https://github.com/RVC-Boss/GPT-SoVITS.git .

# 2. TỰ ĐỘNG SỬA MÃ NGUỒN (Máy sẽ tự làm bước này)
# Sửa cổng 9874 -> 7860 để Hugging Face không bị Timeout
RUN sed -i 's/9874/7860/g' webui.py && \
    # Ép dùng CPU thay vì Card đồ họa (CUDA)
    sed -i 's/is_half = True/is_half = False/g' config.py && \
    sed -i 's/device = "cuda"/device = "cpu"/g' config.py

# 3. Cài đặt các thư viện cần thiết
RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir underthesea

# 4. Tải bộ xử lý ngôn ngữ Roberta (Để tránh lỗi OSError bạn gặp lúc nãy)
RUN mkdir -p GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large && \
    git clone --depth 1 https://huggingface.co/hfl/chinese-roberta-wwm-ext-large /tmp/roberta && \
    cp -r /tmp/roberta/* GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large/ && \
    rm -rf /tmp/roberta

# 5. Cài đặt cổng và môi trường
ENV webui_port=7860
ENV device=cpu
ENV is_half=False

EXPOSE 7860

# Khởi chạy
CMD ["python", "api.py","api_2.py" "-a", "0.0.0.0", "-p", "7860"]