artibex / piper-http

Creates a docker image that runs the piper http service
https://hub.docker.com/r/artibex/piper-http
MIT License
6 stars 4 forks source link

Service crashes #3

Open tebbbb opened 1 month ago

tebbbb commented 1 month ago

I am running this Dockerfile and everything works when i generate a very short sentence. I can also generate it multiple times, but as soon as the text gets a bit longer (and i mean for example "Dies ist ein Test und so weiter bla bla bla", it will always fail when generating for a second time (even with different text). The error i get you can see below the code. A shorter text like "Dies ist ein Test und so" works every time. Also here is how i call the API:

[2024-07-23 18:10:34] local.INFO: Executing command: curl --header "Content-Type: application/json" --request POST --data 'Dies ist ein Test und so weiter bla bla bla' --output '/var/www/html/public/audio/669ff21a45e5d6.99143831.wav' 'http://piper:5000/'

FROM python:3.11-slim

# Set the working directory
WORKDIR /app

# Get the latest version of the code
RUN apt update && apt install -y git && apt-get clean && apt-get autoremove -y

RUN git clone https://github.com/rhasspy/piper

# Update pip and install the required packages
RUN pip install --upgrade pip

# Set the working directory
WORKDIR /app/piper/src/python_run

# Install the package
RUN pip install -e .

# Install the requirements
RUN pip install -r requirements.txt

# Install http server
RUN pip install -r requirements_http.txt

RUN pip install wget

COPY run.py /app

COPY download /app/download

# Copy the folder of piper-voices/de into the container
WORKDIR /app/models

ENV MODEL_DOWNLOAD_LINK="https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/de/de_DE/thorsten/high/de_DE-thorsten-high.onnx?download=true"
ENV MODEL_TARGET_FOLDER="/app/models"
ENV FLASK_ENV=development
ENV FLASK_DEBUG=1
ENV SPEAKER="0"

# Run the webserver with python -m piper.http_server --model ...
CMD python /app/run.py "$MODEL_DOWNLOAD_LINK" "$MODEL_TARGET_FOLDER" "$SPEAKER"
artibex commented 1 month ago

@tebbbb on what hardware are you running it? Perhaps it's a issue with the setup because it works once.

The piper project itself also points out that this is experimental. I created a image a long time ago that worked flawless for me and others at least. It could be that piper got a update that broke this setup sadly

tebbbb commented 1 month ago

@artibex

i fixed it by using this:

RUN pip install -U piper-phonemize RUN pip install onnxruntime==1.17.1

instead of

RUN pip install -r requirements.txt

Current version 1.18 doesnt seem to work. You can also see about it here: https://github.com/rhasspy/piper/issues/552 and in the onnxruntime repository were also issues reported if i remember correctly

I tried it on three different machines. One being my 2023 Lenovo L14 with a Ryzen 7 Pro, then a high performance Hetzner server and my shitty homeserver with an old Celeron. All the same results