Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +16 -19
Dockerfile
CHANGED
|
@@ -1,35 +1,32 @@
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
-
# Install system dependencies
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
-
build-essential \
|
| 6 |
-
|
| 7 |
-
git \
|
| 8 |
-
wget \
|
| 9 |
-
libopenblas-dev \
|
| 10 |
-
libsentencepiece-dev \
|
| 11 |
-
libsndfile1 \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
WORKDIR /app
|
| 15 |
|
| 16 |
-
# Clone
|
| 17 |
RUN git clone https://github.com/kdrkdrkdr/MossTTS-Nano.c.git .
|
| 18 |
-
|
| 19 |
-
# Download the model.bin from the release
|
| 20 |
RUN wget https://github.com/kdrkdrkdr/MossTTS-Nano.c/releases/download/model/model.bin
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
#
|
| 24 |
-
RUN
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
-
#
|
| 29 |
-
RUN
|
| 30 |
|
|
|
|
| 31 |
COPY app.py .
|
| 32 |
|
| 33 |
-
# Expose port 7860 for Hugging Face
|
| 34 |
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
| 35 |
CMD ["python", "app.py"]
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
|
|
|
| 3 |
RUN apt-get update && apt-get install -y \
|
| 4 |
+
build-essential cmake git wget \
|
| 5 |
+
libopenblas-dev libsentencepiece-dev libsndfile1 ffmpeg \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
&& rm -rf /var/lib/apt/lists/*
|
| 7 |
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
+
# Clone and get weights
|
| 11 |
RUN git clone https://github.com/kdrkdrkdr/MossTTS-Nano.c.git .
|
|
|
|
|
|
|
| 12 |
RUN wget https://github.com/kdrkdrkdr/MossTTS-Nano.c/releases/download/model/model.bin
|
| 13 |
|
| 14 |
+
# --- LINUX COMPILATION FIX ---
|
| 15 |
+
# We create a Linux-compatible assembly file for the weights
|
| 16 |
+
RUN printf '.section .data\n.global weights_data\n.global weights_size\n.align 4\nweights_data:\n.incbin "model.bin"\nweights_size:\n.quad . - weights_data\n' > embed_linux.s
|
| 17 |
+
|
| 18 |
+
# Compile the library for Linux (.so)
|
| 19 |
+
# Note: We remove -DEMBED_WEIGHTS from CFLAGS if we want to load from file,
|
| 20 |
+
# but since the code expects embedded, we fix the labels to match Linux convention.
|
| 21 |
+
RUN g++ -c -fPIC sentencepiece.cpp -O2 -std=c++17
|
| 22 |
+
RUN gcc -c -fPIC nanotts.c tensor.c ops.c tts.c codec.c prompt.c audio.c -O2 -std=c11 -DUSE_OPENBLAS -DEMBED_WEIGHTS
|
| 23 |
+
RUN as -o embed_weights.o embed_linux.s
|
| 24 |
|
| 25 |
+
# Link everything into libnanotts.so
|
| 26 |
+
RUN g++ -shared -o libnanotts.so *.o -lopenblas -lsentencepiece -lpthread -lm
|
| 27 |
|
| 28 |
+
RUN pip install gradio numpy pydub
|
| 29 |
COPY app.py .
|
| 30 |
|
|
|
|
| 31 |
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
| 32 |
CMD ["python", "app.py"]
|