Update about paperspace

This commit is contained in:
litagin02
2024-02-22 09:54:32 +09:00
parent 66ed7ce60d
commit fc32ec26cd
3 changed files with 113 additions and 3 deletions

97
Dockerfile Normal file
View File

@@ -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

View File

@@ -87,8 +87,9 @@ python train_ms.py [--repo_id <username>/<repo_name>]
If using JP-Extra model:
```bash
python train_ms_jp_extra.py [--repo_id <username>/<repo_name>]
python train_ms_jp_extra.py [--repo_id <username>/<repo_name>] [--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).

View File

@@ -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
```
前回の設定が残っているので特に前処理等は不要。