WIP Docler

This commit is contained in:
wataru 2023-04-20 00:43:28 +09:00
parent 75ebbe890c
commit 652a8b1685
11 changed files with 284 additions and 1 deletions

View File

@ -1,6 +1,6 @@
## For Developper
[English](/README_dev_ja.md)
[Japanese](/README_dev_ja.md)
## Prerequisit

View File

@ -1,5 +1,7 @@
## VC Client
[Japanese](/README_ja.md)
## What's New!
- v.1.5.2.3a

View File

@ -0,0 +1,95 @@
# FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 as base
# ARG DEBIAN_FRONTEND=noninteractive
# RUN apt-get update
# RUN apt-get install -y python3-pip git
# RUN pip install torch==1.13.1
# RUN pip install numpy==1.24.1
# RUN pip install python-socketio==5.7.2
# RUN pip install fastapi==0.89.1
# RUN pip install python-multipart==0.0.5
# RUN pip install uvicorn==0.20.0
# RUN pip install websockets==10.4
# RUN pip install pyOpenSSL==23.0.0
# RUN pip install onnxruntime-gpu==1.13.1
# RUN git clone https://github.com/isletennos/MMVC_Client.git
# RUN cd MMVC_Client && git checkout 04f3fec4fd82dea6657026ec4e1cd80fb29a415c && cd -
# WORKDIR /
# ADD dummy /
# RUN git clone --depth 1 https://github.com/w-okada/voice-changer.git
#########
# Prod #
#########
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
# FROM nvidia/cuda:12.0.1-cudnn8-runtime-ubuntu22.04
RUN apt-get update \
&& apt-get install -y python3-pip espeak gosu libsndfile1-dev emacs git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN pip install uvicorn==0.21.1
RUN pip install pyOpenSSL==23.1.1
RUN pip install numpy==1.23.5
RUN pip install torch==1.13.1
RUN pip install resampy==0.4.2
RUN pip install python-socketio==5.8.0
RUN pip install fastapi==0.95.1
RUN pip install python-multipart==0.0.6
RUN pip install onnxruntime-gpu==1.14.1
RUN pip install pyworld==0.3.3
RUN pip install scipy==1.10.1
RUN pip install matplotlib==3.7.1
RUN pip install fairseq==0.12.2
RUN pip install websockets==11.0.2
RUN pip install praat-parselmouth==0.4.3
RUN pip install faiss-cpu==1.7.3
RUN pip install torchcrepe==0.0.18
RUN pip install librosa==0.10.0.post1
RUN pip install gin==0.1.6
RUN pip install gin_config==0.5.0
RUN pip install einops==0.6.0
RUN pip install local_attention==1.8.5
RUN pip install websockets==11.0.2
RUN git clone https://github.com/w-okada/voice-changer.git
ADD /setup.sh /voice-changer/server
ADD /exec.sh /voice-changer/server
RUN chmod 0777 /voice-changer/server
WORKDIR /voice-changer/server
RUN git clone https://github.com/isletennos/MMVC_Client.git MMVC_Client_v13
RUN git clone https://github.com/isletennos/MMVC_Client.git MMVC_Client_v15
RUN git clone https://github.com/StarStringStudio/so-vits-svc.git so-vits-svc-40
RUN git clone https://github.com/StarStringStudio/so-vits-svc.git so-vits-svc-40v2
RUN cd so-vits-svc-40v2 && git checkout 08c70ff3d2f7958820b715db2a2180f4b7f92f8d && cd -
RUN git clone https://github.com/yxlllc/DDSP-SVC.git DDSP-SVC
RUN git clone https://github.com/liujing04/Retrieval-based-Voice-Conversion-WebUI.git RVC
ENTRYPOINT ["/bin/bash", "setup.sh"]
# ### Copy from base
# COPY --from=base --chmod=777 /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages
# COPY --from=base --chmod=777 /voice-changer /voice-changer
# COPY --from=base --chmod=777 /MMVC_Client /voice-changer/server/MMVC_Client
# RUN chmod 0777 /voice-changer/server/MMVC_Client
# RUN chmod 0777 /voice-changer/server
# ADD /setup.sh /voice-changer/server
# ADD /exec.sh /voice-changer/server
# WORKDIR /voice-changer/server
# ENTRYPOINT ["/bin/bash", "setup.sh"]
# CMD [ "-h"]

43
docker_vcclient/README.md Normal file
View File

@ -0,0 +1,43 @@
## VC Client for Docker
[English](/README_en.md)
## ビルド
リポジトリフォルダのルートで
```
npm run build:docker:vcclient
```
## 実行
リポジトリフォルダのルートで
```
bash start_docker.sh
```
GPU を使用しない場合は
```
USE_GPU=off bash start_docker.sh
```
ポート番号を変えたい場合は
```
EX_PORT=<port> bash start_docker.sh
```
ローカルのイメージを使用したい場合は
```
USE_LOCAL=on bash start_docker.sh
```
## Push to Repo (only for devs)
```
npm run push:docker:vcclient
```

View File

@ -0,0 +1,43 @@
## VC Client for Docker
[Japanese](/README_ja.md)
## Build
In root folder of repos.
```
npm run build:docker:vcclient
```
## Run
In root folder of repos.
```
bash start_docker.sh
```
Without GPU
```
USE_GPU=off bash start_docker.sh
```
Specify port num
```
EX_PORT=<port> bash start_docker.sh
```
Use Local Image
```
USE_LOCAL=on bash start_docker.sh
```
## Push to Repo (only for devs)
```
npm run push:docker:vcclient
```

20
docker_vcclient/exec.sh Normal file
View File

@ -0,0 +1,20 @@
#!/bin/bash
set -eu
cp -r /weights/* /voice-changer/server/
# /bin/bash
python3 MMVCServerSIO.py $@
# python3 MMVCServerSIO.py -p 18888 --https true \
# --content_vec_500 checkpoint_best_legacy_500.pt \
# --hubert_base hubert_base.pt \
# --hubert_soft hubert-soft-0d54a1f4.pt \
# --nsf_hifigan nsf_hifigan/model
# -p 18888 --https true \
# --content_vec_500 checkpoint_best_legacy_500.pt \
# --hubert_base hubert_base.pt \
# --hubert_soft hubert-soft-0d54a1f4.pt \
# --nsf_hifigan nsf_hifigan/model

18
docker_vcclient/setup.sh Normal file
View File

@ -0,0 +1,18 @@
#!/bin/bash
# 参考:https://programwiz.org/2022/03/22/how-to-write-shell-script-for-option-parsing/
set -eu
# 実行ユーザ作成
USER_ID=${LOCAL_UID:-9001}
GROUP_ID=${LOCAL_GID:-9001}
echo "exec with [UID : $USER_ID, GID: $GROUP_ID]"
useradd -u $USER_ID -o -m user
groupmod -g $GROUP_ID user
#su user
#echo "parameter: $@"
exec /usr/sbin/gosu user /bin/bash exec.sh "$@"
#/bin/bash

2
docker_vcclient/weights/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

View File

@ -7,8 +7,10 @@
"build:docker": "date +%Y%m%d%H%M%S > docker/dummy && DOCKER_BUILDKIT=1 docker build -f docker/Dockerfile docker/ -t voice-changer",
"build:docker:onnx": "DOCKER_BUILDKIT=1 docker build -f docker_onnx/Dockerfile docker/ -t onnx-converter",
"build:docker:trainer": "date +%Y%m%d%H%M%S > docker_trainer/dummy && DOCKER_BUILDKIT=1 docker build -f docker_trainer/Dockerfile docker_trainer/ -t trainer",
"build:docker:vcclient": "date +%Y%m%d%H%M%S > docker/dummy && DOCKER_BUILDKIT=1 docker build -f docker_vcclient/Dockerfile docker_vcclient/ -t vcclient",
"push:docker": "bash script/001_pushDocker.sh",
"push:docker:trainer": "bash script/002_pushDockerTrainer.sh",
"push:docker:vcclient": "bash script/003_pushDockerVCClient.sh",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {

View File

@ -0,0 +1,7 @@
#!/bin/bash
data_tag=`date +%Y%m%d_%H%M%S`
docker login
docker tag vcclient dannadori/vcclient:$data_tag
docker push dannadori/vcclient:$data_tag

51
start_docker.sh Normal file
View File

@ -0,0 +1,51 @@
#!/bin/bash
set -eu
DOCKER_IMAGE=dannadori/vcclient:20230420_003000
#DOCKER_IMAGE=vcclient
### DEFAULT VAR ###
DEFAULT_EX_PORT=18888
DEFAULT_USE_GPU=on # on|off
DEFAULT_USE_LOCAL=off # on|off
### ENV VAR ###
EX_PORT=${EX_PORT:-${DEFAULT_EX_PORT}}
USE_GPU=${USE_GPU:-${DEFAULT_USE_GPU}}
USE_LOCAL=${USE_LOCAL:-${DEFAULT_USE_LOCAL}}
if [ "${USE_LOCAL}" = "on" ]; then
DOCKER_IMAGE=vcclient
fi
if [ "${USE_GPU}" = "on" ]; then
echo "VC Client start...(with gpu)"
docker run -it --rm --gpus all --shm-size=1024M \
-v `pwd`/docker_vcclient/weights:/weights \
-e EX_IP="`hostname -I`" \
-e EX_PORT=${EX_PORT} \
-e LOCAL_UID=$(id -u $USER) \
-e LOCAL_GID=$(id -g $USER) \
-p ${EX_PORT}:18888 \
$DOCKER_IMAGE -p 18888 --https true \
--content_vec_500 checkpoint_best_legacy_500.pt \
--hubert_base hubert_base.pt \
--hubert_soft hubert-soft-0d54a1f4.pt \
--nsf_hifigan nsf_hifigan/model
else
echo "VC Client start...(cpu)"
docker run -it --rm --shm-size=1024M \
-v `pwd`/docker_vcclient/weights:/weights \
-e EX_IP="`hostname -I`" \
-e EX_PORT=${EX_PORT} \
-e LOCAL_UID=$(id -u $USER) \
-e LOCAL_GID=$(id -g $USER) \
-p ${EX_PORT}:18888 \
$DOCKER_IMAGE -p 18888 --https true \
--content_vec_500 checkpoint_best_legacy_500.pt \
--hubert_base hubert_base.pt \
--hubert_soft hubert-soft-0d54a1f4.pt \
--nsf_hifigan nsf_hifigan/model
fi