Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker image #273

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM nvidia/cuda:11.3.1-base-ubuntu20.04

ENV PYTHON_VERSION=3.8

RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qq update \
&& apt-get -qq install --no-install-recommends \
libsndfile1-dev \
git \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-venv \
python3-pip \
&& rm -rf /var/lib/apt/lists/*

RUN ln -s -f /usr/bin/python${PYTHON_VERSION} /usr/bin/python3 && \
ln -s -f /usr/bin/python${PYTHON_VERSION} /usr/bin/python && \
ln -s -f /usr/bin/pip3 /usr/bin/pip

RUN pip install --upgrade pip

# 2. Copy files
COPY . /src

RUN pip install torch==1.12.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113

WORKDIR /src
# 3. Install dependencies
RUN pip install -r requirements-docker.txt

RUN python3 setup.py install



31 changes: 31 additions & 0 deletions Dockerfile.moderngpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

FROM nvidia/cuda:11.8.0-base-ubuntu20.04

ENV PYTHON_VERSION=3.8

RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qq update \
&& apt-get -qq install --no-install-recommends \
libsndfile1-dev \
git \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-venv \
python3-pip \
&& rm -rf /var/lib/apt/lists/*

RUN ln -s -f /usr/bin/python${PYTHON_VERSION} /usr/bin/python3 && \
ln -s -f /usr/bin/python${PYTHON_VERSION} /usr/bin/python && \
ln -s -f /usr/bin/pip3 /usr/bin/pip

RUN pip install --upgrade pip

# 2. Copy files
COPY . /src

RUN pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu118

WORKDIR /src
# 3. Install dependencies
RUN pip install -r requirements-docker.txt

RUN python3 setup.py install
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,18 @@ good clips:
5. Try to find clips that are spoken in such a way as you wish your output to sound like. For example, if you want to hear your target voice read an audiobook, try to find clips of them reading a book.
6. The text being spoken in the clips does not matter, but diverse text does seem to perform better.

### Using it with Docker
To use Gpu with Docker [install the appropriate drivers and the NVIDIA Container Runtime](https://docs.docker.com/config/containers/resource_constraints/#gpu).
If you have a modern GPU like RTX 4090 you can build yout docker image using Dockerfile.moderngpu file.
If you have an older GPU like K80 or V100 you can use the other Dockerfile .
Download models and put them in a models folder, create an empty transformers folder to serve as download cache for huggingface transformers.
Mount it as a volume in your container
It's also useful to mount another volume for the outputs so create an outputs folder too

```shell
docker run -v models:/src/models outputs:/outputs -e "TORTOISE_MODELS_DIR=/src/models" -e "TRANSFORMERS_CACHE=/src/models/transformers" --rm --gpus all tortoise_tts:latest python tortoise/do_tts.py --text "I'm going to speak this" --voice random --preset fast --output_path /outputs
```

## Advanced Usage

### Generation settings
Expand Down
15 changes: 15 additions & 0 deletions requirements-docker.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
tqdm
rotary_embedding_torch
transformers==4.19
tokenizers
inflect
progressbar
einops
unidecode
scipy
librosa
numpy==1.20.0
numba==0.48.0
threadpoolctl
llvmlite
appdirs