From 2fc30192b79c4ba1666f3b230c8b90357357ab36 Mon Sep 17 00:00:00 2001 From: rgkirch <6143833+rgkirch@users.noreply.github.com> Date: Sat, 2 Sep 2023 18:45:36 -0400 Subject: [PATCH 1/2] Create Dockerfile --- Dockerfile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5d1a162 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +FROM nvidia/cuda:12.2.0-base-ubuntu22.04 + +COPY . /app + +RUN apt-get update && \ + apt-get install -y --allow-unauthenticated --no-install-recommends \ + wget \ + git \ + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* + +ENV HOME "/root" +ENV CONDA_DIR "${HOME}/miniconda" +ENV PATH="$CONDA_DIR/bin":$PATH +ENV CONDA_AUTO_UPDATE_CONDA=false +ENV PIP_DOWNLOAD_CACHE="$HOME/.pip/cache" +ENV TORTOISE_MODELS_DIR + +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda3.sh \ + && bash /tmp/miniconda3.sh -b -p "${CONDA_DIR}" -f -u \ + && "${CONDA_DIR}/bin/conda" init bash \ + && rm -f /tmp/miniconda3.sh \ + && echo ". '${CONDA_DIR}/etc/profile.d/conda.sh'" >> "${HOME}/.profile" + +# --login option used to source bashrc (thus activating conda env) at every RUN statement +SHELL ["/bin/bash", "--login", "-c"] + +RUN conda create --name tortoise python=3.9 numba inflect \ + && conda activate tortoise \ + && conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia \ + && conda install transformers=4.29.2 \ + && cd /app \ + && python setup.py install From 19849c61d11c68586c214388ecb9160bb47c1b9e Mon Sep 17 00:00:00 2001 From: rgkirch <6143833+rgkirch@users.noreply.github.com> Date: Sat, 2 Sep 2023 18:58:05 -0400 Subject: [PATCH 2/2] add instructions on how to use with Dockerfile --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index e72a918..ef3cd6c 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,38 @@ Optionally, pytorch can be installed in the base environment, so that other cond If you are on windows, you may also need to install pysoundfile: `conda install -c conda-forge pysoundfile` +### Docker + +An easy way to hit the ground running and a good jumping off point depending on your use case. + +```sh +git clone https://github.com/neonbjb/tortoise-tts.git +cd tortoise-tts + +docker build . -t tts + +docker run --gpus all \ + -e TORTOISE_MODELS_DIR=/models \ + -v /mnt/user/data/tortoise_tts/models:/models \ + -v /mnt/user/data/tortoise_tts/results:/results \ + -v /mnt/user/data/.cache/huggingface:/root/.cache/huggingface \ + -v /root:/work \ + -it tts +``` +This gives you an interactive terminal in an environment that's ready to do some tts. Now you can explore the different interfaces that tortoise exposes for tts. + +For example: + +```sh +cd app +conda activate tortoise +time python tortoise/do_tts.py \ + --output_path /results \ + --preset ultra_fast \ + --voice geralt \ + --text "Time flies like an arrow; fruit flies like a bananna." +``` + ## Apple Silicon On MacOS 13+ with M1/M2 chips you need to install the nighly version of pytorch, as stated in the official page you can do: