diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..790c9c2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,97 @@ +# ================================================================== +# Initial setup +# ------------------------------------------------------------------ + +# Ubuntu 22.04 as base image +FROM ubuntu:22.04 +# RUN yes| unminimize + +# Set ENV variables +ENV LANG C.UTF-8 +ENV SHELL=/bin/bash +ENV DEBIAN_FRONTEND=noninteractive + +ENV APT_INSTALL="apt-get install -y --no-install-recommends" +ENV PIP_INSTALL="python3 -m pip --no-cache-dir install --upgrade" +ENV GIT_CLONE="git clone --depth 10" + +# ================================================================== +# Tools +# ------------------------------------------------------------------ + +RUN apt-get update && \ + $APT_INSTALL \ + sudo \ + build-essential \ + ca-certificates \ + wget \ + curl \ + git \ + zip \ + unzip \ + nano \ + ffmpeg \ + software-properties-common \ + gnupg \ + python3 \ + python3-pip \ + python3-dev + +# ================================================================== +# Git-lfs +# ------------------------------------------------------------------ + +RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash && \ + $APT_INSTALL git-lfs + + +# Add symlink so python and python3 commands use same python3.9 executable +RUN ln -s /usr/bin/python3 /usr/local/bin/python + +# ================================================================== +# Installing CUDA packages (CUDA Toolkit 12.0 and CUDNN 8.9.7) +# ------------------------------------------------------------------ +RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin && \ + mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600 && \ + wget https://developer.download.nvidia.com/compute/cuda/12.0.0/local_installers/cuda-repo-ubuntu2204-12-0-local_12.0.0-525.60.13-1_amd64.deb && \ + dpkg -i cuda-repo-ubuntu2204-12-0-local_12.0.0-525.60.13-1_amd64.deb && \ + cp /var/cuda-repo-ubuntu2204-12-0-local/cuda-*-keyring.gpg /usr/share/keyrings/ && \ + apt-get update && \ + $APT_INSTALL cuda && \ + rm cuda-repo-ubuntu2204-12-0-local_12.0.0-525.60.13-1_amd64.deb + +# Installing CUDNN +RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub && \ + add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /" && \ + apt-get update && \ + $APT_INSTALL libcudnn8=8.9.7.29-1+cuda12.2 \ + libcudnn8-dev=8.9.7.29-1+cuda12.2 + + +ENV PATH=$PATH:/usr/local/cuda/bin +ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH + + +# ================================================================== +# PyTorch +# ------------------------------------------------------------------ + +# Based on https://pytorch.org/get-started/locally/ + +RUN $PIP_INSTALL torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu118 + + +RUN $PIP_INSTALL jupyterlab + +# Install requirements.txt from the project +COPY requirements.txt /tmp/requirements.txt +RUN $PIP_INSTALL -r /tmp/requirements.txt +RUN rm /tmp/requirements.txt + +# ================================================================== +# Startup +# ------------------------------------------------------------------ + +EXPOSE 8888 6006 + +CMD jupyter lab --allow-root --ip=0.0.0.0 --no-browser --ServerApp.trust_xheaders=True --ServerApp.disable_check_xsrf=False --ServerApp.allow_remote_access=True --ServerApp.allow_origin='*' --ServerApp.allow_credentials=True \ No newline at end of file diff --git a/docs/CLI.md b/docs/CLI.md index 3873475..88ad5fd 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -87,8 +87,9 @@ python train_ms.py [--repo_id /] If using JP-Extra model: ```bash -python train_ms_jp_extra.py [--repo_id /] +python train_ms_jp_extra.py [--repo_id /] [--skip_default_style] ``` Optional: - `--repo_id`: Hugging Face repository ID to upload the trained model to. You should have logged in using `huggingface-cli login` before running this command. +- `--skip_default_style`: Skip making the default style vector. Use this if you want to resume training (since the default style vector is already made). diff --git a/docs/paperspace.md b/docs/paperspace.md index f5d3770..924d3b3 100644 --- a/docs/paperspace.md +++ b/docs/paperspace.md @@ -25,8 +25,8 @@ git clone https://github.com/litagin02/Style-Bert-VITS2.git ``` 環境構築(デフォルトはPyTorch 1.x系、Python 3.9の模様) ```bash -pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu118 -pip install -r requirements.txt +cd /storage/sbv2/Style-Bert-VITS2 +pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu118 && pip install -r requirements.txt ``` 事前学習済みモデル等のダウンロード、またパスを`/notebooks/`以下のものに設定 ```bash @@ -70,3 +70,15 @@ Hugging faceの`username/sbv2-private`というモデルリポジトリに学習 python train_ms_jp_extra.py --repo_id username/sbv2-private ``` (JP-Extraでない場合は`train_ms.py`を使う) + +### 4. 学習再開 + +Notebooksの時間制限が切れてから別Notebooksで同じモデルを学習を再開する場合(環境構築は必要)。 +```bash +huggingface-cli login +cd /notebooks +huggingface-cli download username/sbv2-private --include "Data/Foo/*" --local-dir . +cd /storage/sbv2/Style-Bert-VITS2 +python train_ms_jp_extra.py --repo_id username/sbv2-private --skip_default_style +``` +前回の設定が残っているので特に前処理等は不要。 \ No newline at end of file