Update TTS component
This commit is contained in:
@@ -20,15 +20,28 @@ services:
|
||||
networks:
|
||||
- nointernet
|
||||
|
||||
openedai-speech:
|
||||
ollama_provision:
|
||||
build:
|
||||
dockerfile: src/tts/Dockerfile
|
||||
dockerfile: src/ollama_provision/Dockerfile
|
||||
environment:
|
||||
- TTS_HOME=voices
|
||||
- MODELS=nomic-embed-text,llama3.1:8b,qwen2.5:7b,gemma3:12b-it-qat,gemma3:27b-it-qat,gpt-oss:20b
|
||||
volumes:
|
||||
- voices:/app/voices
|
||||
- speech-config:/app/config
|
||||
- ollama:/root/.ollama
|
||||
restart: no
|
||||
depends_on:
|
||||
ollama:
|
||||
condition: service_healthy
|
||||
restart: true
|
||||
links:
|
||||
- ollama
|
||||
networks:
|
||||
- internet
|
||||
|
||||
speaches-ai:
|
||||
image: ghcr.io/speaches-ai/speaches:latest-cuda
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- hf-hub-cache:/home/ubuntu/.cache/huggingface/hub
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
@@ -45,20 +58,19 @@ services:
|
||||
networks:
|
||||
- nointernet
|
||||
|
||||
ollama_provision:
|
||||
speaches-ai_provision:
|
||||
build:
|
||||
dockerfile: src/ollama_provision/Dockerfile
|
||||
environment:
|
||||
- MODELS=qwen2.5:latest,qwen2.5-coder:32b,nomic-embed-text:latest,gemma2:latest,mistral:latest,deepseek-r1:7b,deepcoder:14b
|
||||
dockerfile: src/speaches-ai_provision/Dockerfile
|
||||
volumes:
|
||||
- ollama:/root/.ollama
|
||||
- hf-hub-cache:/home/ubuntu/.cache/huggingface/hub
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: nvidia
|
||||
count: all
|
||||
capabilities: [gpu]
|
||||
restart: no
|
||||
depends_on:
|
||||
ollama:
|
||||
condition: service_healthy
|
||||
restart: true
|
||||
links:
|
||||
- ollama
|
||||
networks:
|
||||
- internet
|
||||
|
||||
@@ -89,17 +101,23 @@ services:
|
||||
- NGINX_ENVSUBST_OUTPUT_DIR=/etc/nginx
|
||||
- API_KEY=${LLM_API_KEY}
|
||||
depends_on:
|
||||
- openedai-speech
|
||||
- ollama
|
||||
- speaches-ai
|
||||
- aichat
|
||||
links:
|
||||
- ollama
|
||||
- openedai-speech
|
||||
- speaches-ai
|
||||
- aichat
|
||||
ports:
|
||||
- "127.0.0.1:11434:11434"
|
||||
- "127.0.0.1:10434:10434"
|
||||
- "127.0.0.1:8000:8000"
|
||||
- "127.0.0.1:8001:8001"
|
||||
healthcheck:
|
||||
test: curl --fail http://localhost:11434 || exit 1
|
||||
interval: 10s
|
||||
retries: 5
|
||||
start_period: 10s
|
||||
timeout: 10s
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- internet
|
||||
@@ -107,8 +125,7 @@ services:
|
||||
|
||||
volumes:
|
||||
ollama:
|
||||
voices:
|
||||
speech-config:
|
||||
hf-hub-cache:
|
||||
|
||||
networks:
|
||||
internet:
|
||||
|
||||
@@ -30,7 +30,7 @@ http {
|
||||
return 403;
|
||||
}
|
||||
location / {
|
||||
proxy_pass http://openedai-speech:8000;
|
||||
proxy_pass http://speaches-ai:8000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
@@ -48,6 +48,9 @@ http {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
9
src/speaches-ai_provision/Dockerfile
Normal file
9
src/speaches-ai_provision/Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
||||
FROM ghcr.io/speaches-ai/speaches:latest-cuda
|
||||
|
||||
USER root
|
||||
ADD ./src/speaches-ai_provision/entrypoint.sh /entrypoint.sh
|
||||
RUN chmod 755 /entrypoint.sh
|
||||
|
||||
USER ubuntu
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
14
src/speaches-ai_provision/entrypoint.sh
Normal file
14
src/speaches-ai_provision/entrypoint.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
pkill -f uvicorn
|
||||
source .venv/bin/activate
|
||||
uvicorn --factory speaches.main:create_app &
|
||||
sleep 5
|
||||
curl -s -X POST -d '' 'http://localhost:8000/v1/models/speaches-ai/Kokoro-82M-v1.0-ONNX-int8'
|
||||
curl -s -X POST -d '' 'http://localhost:8000/v1/models/speaches-ai/piper-fr_FR-tom-medium'
|
||||
curl -s -X POST -d '' 'http://localhost:8000/v1/models/speaches-ai/piper-fr_FR-upmc-medium'
|
||||
curl -s -X POST -d '' 'http://localhost:8000/v1/models/speaches-ai/piper-en_GB-alba-medium'
|
||||
curl -s -X POST -d '' 'http://localhost:8000/v1/models/speaches-ai/piper-en_GB-northern_english_male-medium'
|
||||
curl -s -X POST -d '' 'http://localhost:8000/v1/models/speaches-ai/piper-en_US-john-medium'
|
||||
curl -s -X POST -d '' 'http://localhost:8000/v1/models/speaches-ai/piper-en_US-bryce-medium'
|
||||
curl -s -X POST -d '' 'http://localhost:8000/v1/models/speaches-ai/piper-en_US-ryan-high'
|
||||
@@ -1,49 +0,0 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
RUN --mount=type=cache,target=/root/.cache/pip pip install -U pip
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
RUN <<EOF
|
||||
apt-get update
|
||||
apt-get install --no-install-recommends -y curl ffmpeg git
|
||||
if [ "$TARGETPLATFORM" != "linux/amd64" ]; then
|
||||
apt-get install --no-install-recommends -y build-essential
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
fi
|
||||
|
||||
# for deepspeed support - image +7.5GB, over the 10GB ghcr.io limit, and no noticable gain in speed or VRAM usage?
|
||||
#curl -O https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/cuda-keyring_1.1-1_all.deb
|
||||
#dpkg -i cuda-keyring_1.1-1_all.deb
|
||||
#rm cuda-keyring_1.1-1_all.deb
|
||||
#apt-get install --no-install-recommends -y libaio-dev build-essential cuda-toolkit
|
||||
|
||||
apt-get clean
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
EOF
|
||||
#ENV CUDA_HOME=/usr/local/cuda
|
||||
ENV PATH="/root/.cargo/bin:${PATH}"
|
||||
|
||||
WORKDIR /app
|
||||
RUN mkdir -p voices config
|
||||
|
||||
ARG USE_ROCM
|
||||
ENV USE_ROCM=${USE_ROCM}
|
||||
|
||||
RUN git clone https://github.com/matatonic/openedai-speech.git /tmp/app
|
||||
RUN mv /tmp/app/* /app/
|
||||
ADD src/tts/download_voices_tts-1.sh /app/download_voices_tts-1.sh
|
||||
ADD src/tts/voice_to_speaker.default.yaml /app/voice_to_speaker.default.yaml
|
||||
RUN if [ "${USE_ROCM}" = "1" ]; then mv /app/requirements-rocm.txt /app/requirements.txt; fi
|
||||
RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt
|
||||
|
||||
|
||||
ARG PRELOAD_MODEL
|
||||
ENV PRELOAD_MODEL=${PRELOAD_MODEL}
|
||||
ENV TTS_HOME=voices
|
||||
ENV HF_HOME=voices
|
||||
ENV COQUI_TOS_AGREED=1
|
||||
|
||||
RUN bash /app/download_voices_tts-1.sh
|
||||
|
||||
CMD bash startup.sh
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
# cat voice_to_speaker.default.yaml | yq '.tts-1 ' | grep mode | cut -d'/' -f2 | cut -d'.' -f1 | sort -u | xargs
|
||||
models=${*:-"en_GB-alba-medium en_GB-northern_english_male-medium en_US-bryce-medium en_US-john-medium en_US-libritts_r-medium en_US-ryan-high fr_FR-siwis-medium fr_FR-tom-medium fr_FR-upmc-medium"}
|
||||
piper --update-voices --data-dir voices --download-dir voices --model x 2> /dev/null
|
||||
for i in $models ; do
|
||||
[ ! -e "voices/$i.onnx" ] && piper --data-dir voices --download-dir voices --model $i < /dev/null > /dev/null
|
||||
done
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
# Use https://rhasspy.github.io/piper-samples/ to configure
|
||||
tts-1:
|
||||
alloy:
|
||||
model: voices/en_US-libritts_r-medium.onnx
|
||||
speaker: 79
|
||||
siwis:
|
||||
model: voices/fr_FR-siwis-medium.onnx
|
||||
speaker: 0
|
||||
tom:
|
||||
model: voices/fr_FR-tom-medium.onnx
|
||||
speaker: 0
|
||||
pierre:
|
||||
model: voices/fr_FR-upmc-medium.onnx
|
||||
speaker: 1
|
||||
jessica:
|
||||
model: voices/fr_FR-upmc-medium.onnx
|
||||
speaker: 0
|
||||
alba:
|
||||
model: voices/en_GB-alba-medium.onnx
|
||||
speaker: 0
|
||||
jack:
|
||||
model: voices/en_GB-northern_english_male-medium.onnx
|
||||
speaker: 0
|
||||
john:
|
||||
model: voices/en_US-john-medium.onnx
|
||||
speaker: 0
|
||||
bryce:
|
||||
model: voices/en_US-bryce-medium.onnx
|
||||
speaker: 0
|
||||
ryan:
|
||||
model: voices/en_US-ryan-high.onnx
|
||||
speaker: 0
|
||||
echo:
|
||||
model: voices/en_US-libritts_r-medium.onnx
|
||||
speaker: 134
|
||||
|
||||
@@ -25,21 +25,30 @@ fi
|
||||
|
||||
tts_host=${TTS_API_HOST:-"http://localhost:8000"}
|
||||
|
||||
declare -A voices_model=(
|
||||
[ff_siwis]="speaches-ai/Kokoro-82M-v1.0-ONNX-int8"
|
||||
[tom]="speaches-ai/piper-fr_FR-tom-medium"
|
||||
[upmc]="speaches-ai/piper-fr_FR-upmc-medium"
|
||||
[alba]="speaches-ai/piper-en_GB-alba-medium"
|
||||
[northern_english_male]="speaches-ai/piper-en_GB-northern_english_male-medium"
|
||||
[john]="speaches-ai/piper-en_US-john-medium"
|
||||
[bryce]="speaches-ai/piper-en_US-bryce-medium"
|
||||
[ryan]="speaches-ai/piper-en_US-ryan-high"
|
||||
)
|
||||
|
||||
_choice_voice() {
|
||||
|
||||
if [[ "${argc_lang}" == "fr" ]]; then
|
||||
echo siwis
|
||||
echo ff_siwis
|
||||
echo tom
|
||||
echo pierre
|
||||
echo jessica
|
||||
echo upmc
|
||||
fi
|
||||
if [[ "${argc_lang}" == "en" ]]; then
|
||||
echo alba
|
||||
echo jack
|
||||
echo northern_english_male
|
||||
echo john
|
||||
echo bryce
|
||||
echo ryan
|
||||
echo echo
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -52,10 +61,11 @@ _choice_voice() {
|
||||
# @arg text! Set the text
|
||||
synthesize() {
|
||||
|
||||
http_status_code=$(curl -s "${tts_host}/v1/audio/speech" -o "${argc_filename}" -w "%{http_code}" \
|
||||
model=$(echo ${voices_model[$argc_voice]})
|
||||
http_status_code=$(curl -s -X POST "${tts_host}/v1/audio/speech" -o "${argc_filename}" -w "%{http_code}" \
|
||||
-H "Authorization: Bearer ${LLM_API_KEY}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"model\": \"tts-1\",\"input\": \"${argc_text}\",\"voice\": \"${argc_voice}\",\"response_format\": \"wav\",\"speed\": ${argc_speed}}")
|
||||
-d "{\"model\": \"${model}\",\"input\": \"${argc_text}\",\"voice\": \"${argc_voice}\",\"response_format\": \"wav\",\"speed\": ${argc_speed}}")
|
||||
|
||||
# Check the response code for successful HTTP request
|
||||
if [[ "${http_status_code}" -ne 200 ]]; then
|
||||
|
||||
Reference in New Issue
Block a user