From 59bba200693e9b25383a514f818f950ab3dfd092 Mon Sep 17 00:00:00 2001 From: Kaszanas Date: Sat, 18 Nov 2023 15:35:12 +0100 Subject: [PATCH 1/3] Moved Dockerfile, COPY at the end This change should prevent re-installation of the dependencies upon every change of the repository's contents. Typically if Docker detects that something changed in a layer, all downstream layers are invalidated and rebuilt. --- Dockerfile => dockerfiles/Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) rename Dockerfile => dockerfiles/Dockerfile (89%) diff --git a/Dockerfile b/dockerfiles/Dockerfile similarity index 89% rename from Dockerfile rename to dockerfiles/Dockerfile index 30dfb23d0d..e3fcdd8388 100644 --- a/Dockerfile +++ b/dockerfiles/Dockerfile @@ -1,13 +1,18 @@ ARG BASE=nvidia/cuda:11.8.0-base-ubuntu22.04 FROM ${BASE} + RUN apt-get update && apt-get upgrade -y RUN apt-get install -y --no-install-recommends gcc g++ make python3 python3-dev python3-pip python3-venv python3-wheel espeak-ng libsndfile1-dev && rm -rf /var/lib/apt/lists/* RUN pip3 install llvmlite --ignore-installed -WORKDIR /root -COPY . /root +# Install Dependencies: RUN pip3 install torch torchaudio --extra-index-url https://download.pytorch.org/whl/cu118 RUN rm -rf /root/.cache/pip RUN make install + +# Copy TTS repository contents: +WORKDIR /root +COPY . /root + ENTRYPOINT ["tts"] CMD ["--help"] From 808fa4995256a3a9a97bed6c8fa8c03f82c1ab1c Mon Sep 17 00:00:00 2001 From: Kaszanas Date: Sat, 18 Nov 2023 17:33:42 +0100 Subject: [PATCH 2/3] Moved Dockerfile back to main directory Main dockerfile in a separate directory can cause issues with the current CI/CD setup. This can be a good change for later. --- dockerfiles/Dockerfile => Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) rename dockerfiles/Dockerfile => Dockerfile (99%) diff --git a/dockerfiles/Dockerfile b/Dockerfile similarity index 99% rename from dockerfiles/Dockerfile rename to Dockerfile index e3fcdd8388..9fb3005ef4 100644 --- a/dockerfiles/Dockerfile +++ b/Dockerfile @@ -8,11 +8,12 @@ RUN pip3 install llvmlite --ignore-installed # Install Dependencies: RUN pip3 install torch torchaudio --extra-index-url https://download.pytorch.org/whl/cu118 RUN rm -rf /root/.cache/pip -RUN make install # Copy TTS repository contents: WORKDIR /root COPY . /root +RUN make install + ENTRYPOINT ["tts"] CMD ["--help"] From bfa0291a214454204e26afea4930b06a0c2a48c5 Mon Sep 17 00:00:00 2001 From: Kaszanas Date: Sat, 18 Nov 2023 17:34:36 +0100 Subject: [PATCH 3/3] Introduced Dockerfile.dev, updated CONTRIBUTING Dockerfile.dev can be used as a separate development environment for anyone that does not wish to install the dependencies locally. --- CONTRIBUTING.md | 26 ++++++++++++++++++++++ dockerfiles/Dockerfile.dev | 44 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 dockerfiles/Dockerfile.dev diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ade35507d2..cae35993dc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -128,6 +128,32 @@ The following steps are tested on an Ubuntu system. 14. Once things look perfect, We merge it to the ```dev``` branch and make it ready for the next version. +## Development in Docker container + +If you prefer working within a Docker container as your development environment, you can do the following: + +1. Fork 🐸TTS[https://github.com/coqui-ai/TTS] by clicking the fork button at the top right corner of the project page. + +2. Clone 🐸TTS and add the main repo as a new remote named ```upsteam```. + + ```bash + $ git clone git@github.com:/TTS.git + $ cd TTS + $ git remote add upstream https://github.com/coqui-ai/TTS.git + ``` + +3. Build the Docker Image as your development environment (it installs all of the dependencies for you): + + ``` + docker build --tag=tts-dev:latest -f .\dockerfiles\Dockerfile.dev . + ``` + +4. Run the container with GPU support: + + ``` + docker run -it --gpus all tts-dev:latest /bin/bash + ``` + Feel free to ping us at any step you need help using our communication channels. If you are new to Github or open-source contribution, These are good resources. diff --git a/dockerfiles/Dockerfile.dev b/dockerfiles/Dockerfile.dev new file mode 100644 index 0000000000..58baee53e2 --- /dev/null +++ b/dockerfiles/Dockerfile.dev @@ -0,0 +1,44 @@ +ARG BASE=nvidia/cuda:11.8.0-base-ubuntu22.04 +FROM ${BASE} + +# Install OS dependencies: +RUN apt-get update && apt-get upgrade -y +RUN apt-get install -y --no-install-recommends \ + gcc g++ \ + make \ + python3 python3-dev python3-pip python3-venv python3-wheel \ + espeak-ng libsndfile1-dev \ + && rm -rf /var/lib/apt/lists/* + +# Install Major Python Dependencies: +RUN pip3 install llvmlite --ignore-installed +RUN pip3 install torch torchaudio --extra-index-url https://download.pytorch.org/whl/cu118 +RUN rm -rf /root/.cache/pip + +WORKDIR /root + +# Copy Dependency Lock Files: +COPY \ + Makefile \ + pyproject.toml \ + setup.py \ + requirements.dev.txt \ + requirements.ja.txt \ + requirements.notebooks.txt \ + requirements.txt \ + /root/ + +# Install Project Dependencies +# Separate stage to limit re-downloading: +RUN pip install \ + -r requirements.txt \ + -r requirements.dev.txt \ + -r requirements.ja.txt \ + -r requirements.notebooks.txt + +# Copy TTS repository contents: +COPY . /root + +# Installing the TTS package itself: +RUN make install +