diff --git a/package.json b/package.json index 349b15ca..97d98e4b 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "", "main": "index.js", "scripts": { - "build:docker": "date +%Y%m%d%H%M%S > trainer/dummy && DOCKER_BUILDKIT=1 docker build --ssh default -f trainer/Dockerfile trainer/ -t mmvc_trainer_docker", + "build:docker": "date +%Y%m%d%H%M%S > trainer/dummy && DOCKER_BUILDKIT=1 docker build -f trainer/Dockerfile trainer/ -t voice-changer", + "push:docker": "bash script/001_pushDocker.sh", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { diff --git a/script/001_pushDocker.sh b/script/001_pushDocker.sh new file mode 100644 index 00000000..edce5d70 --- /dev/null +++ b/script/001_pushDocker.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +data_tag=`date +%Y%m%d_%H%M%S` +docker login + +docker tag voice-changer dannadori/voice-changer:$data_tag +docker push dannadori/voice-changer:$data_tag diff --git a/start.sh b/start.sh index cff66724..5d4f1649 100644 --- a/start.sh +++ b/start.sh @@ -7,7 +7,9 @@ docker run -it --gpus all --shm-size=2g \ -v `pwd`/exp/${EXP_NAME}/dataset:/MMVC_Trainer/dataset \ -v `pwd`/exp/${EXP_NAME}/logs:/MMVC_Trainer/logs \ -v `pwd`/exp/${EXP_NAME}/filelists:/MMVC_Trainer/filelists \ - -v `pwd`/exp/${EXP_NAME}/filelists:/voice-changer-internal/voice-change-service/filelists + -v `pwd`/vc_resources:/resources \ -e LOCAL_UID=$(id -u $USER) \ -e LOCAL_GID=$(id -g $USER) \ - -p 6008:6006 mmvc_trainer_docker "$@" \ No newline at end of file + -p 6008:6006 -p 8081:8080 mmvc_trainer_docker "$@" + + diff --git a/trainer/Dockerfile b/trainer/Dockerfile index 4d1a980e..c3c52335 100644 --- a/trainer/Dockerfile +++ b/trainer/Dockerfile @@ -1,3 +1,4 @@ +FROM dannadori/voice-changer-internal:20220823_035121 as front FROM debian:bullseye-slim as base ARG DEBIAN_FRONTEND=noninteractive @@ -36,64 +37,25 @@ RUN cythonize -3 -i core.pyx \ FROM debian:bullseye-slim RUN apt-get update \ - && apt-get install -y python3-pip espeak gosu\ + && apt-get install -y python3-pip espeak gosu libsndfile1-dev\ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -COPY --from=base /usr/local/lib/python3.9/dist-packages /usr/local/lib/python3.9/dist-packages -COPY --from=base /MMVC_Trainer /MMVC_Trainer - +### Copy local resource COPY fine_model/G_180000.pth /MMVC_Trainer/fine_model/G_180000.pth COPY fine_model/D_180000.pth /MMVC_Trainer/fine_model/D_180000.pth -# RUN groupadd -g 61000 docker -# RUN useradd -g 61000 -l -m -s /bin/false -u 61000 docker -# USER docker +### Copy from base +COPY --from=base --chmod=777 /usr/local/lib/python3.9/dist-packages /usr/local/lib/python3.9/dist-packages +COPY --from=base --chmod=777 /MMVC_Trainer /MMVC_Trainer WORKDIR /MMVC_Trainer ADD /setup.sh /MMVC_Trainer/ ADD /exec.sh /MMVC_Trainer/ -RUN chmod 0777 . -R -# RUN chmod 0777 exec.sh -# RUN chmod 0666 train_ms.py -RUN chmod 0777 /usr/local/lib/python3.9/dist-packages/pyopenjtalk +### Copy from frontend +COPY --from=front --chmod=777 /voice-changer-internal/frontend/dist /voice-changer-internal/frontend/dist +COPY --from=front --chmod=777 /voice-changer-internal/voice-change-service /voice-changer-internal/voice-change-service +RUN chmod 0777 /voice-changer-internal/voice-change-service ENTRYPOINT ["/bin/bash", "setup.sh"] CMD [ "-h"] - -# FROM ubuntu:focal-20220531 as base - -# ARG DEBIAN_FRONTEND=noninteractive - -# RUN apt-get update && apt-get install -y libfreetype6-dev g++ cmake sox libsndfile1-dev ffmpeg flac python3-pip -# RUN apt-get install -y git emacs mlocate curl wget unzip - -# RUN git clone https://github.com/isletennos/MMVC_Trainer.git - -# RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \ -# sh Miniconda3-latest-Linux-x86_64.sh -b -p /opt/miniconda3 && \ -# rm -r Miniconda3-latest-Linux-x86_64.sh - -# ENV PATH /opt/miniconda3/bin:$PATH -# RUN pip install --upgrade pip && \ -# conda update conda && \ -# conda create -n mmvc -c defaults python=3.7 && \ -# conda init && \ -# echo "conda activate mmvc" >> ~/.bashrc - -# SHELL ["conda", "run", "-n", "mmvc", "/bin/bash", "-c"] - -# ENV CONDA_DEFAULT_ENV mmvc && \ -# PATH /opt/conda/envs/mmvc/bin:$PATH - -# RUN pip install pyopenjtalk -# RUN pip install Cython==0.29.21 librosa==0.8.0 matplotlib==3.3.1 numpy phonemizer==2.2.1 scipy==1.5.2 tensorboard Unidecode==1.1.1 retry tqdm resampy==0.2.2 -# RUN pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113 - -# RUN pip install psutil - -# COPY fine_model/G_180000.pth /MMVC_Trainer/fine_model/G_180000.pth -# COPY fine_model/D_180000.pth /MMVC_Trainer/fine_model/D_180000.pth - -# WORKDIR /MMVC_Trainer - diff --git a/trainer/exec.sh b/trainer/exec.sh index 7bd03fbd..f2e21c64 100644 --- a/trainer/exec.sh +++ b/trainer/exec.sh @@ -41,7 +41,7 @@ config= model= # オプション解析 -while getopts tb:rvc:m:h OPT; do +while getopts tb:rvm:c:h OPT; do case $OPT in t) training_flag=true @@ -106,17 +106,22 @@ if $training_flag; then fi fi -# if $voice_change_flag; then -# if [[ -z "$config" ]]; then -# warn "コンフィグファイル(-c)を指定してください" -# fi -# if [[ -z "$model" ]]; then -# warn "モデルファイル(-m)を指定してください" -# fi +if $voice_change_flag; then + if [[ -z "$config" ]]; then + warn "コンフィグファイル(-c)を指定してください" + fi + if [[ -z "$model" ]]; then + warn "モデルファイル(-m)を指定してください" + fi -# cp -r /resources/* . -# if [[ -e ./setting.json ]]; then -# cp ./setting.json ../frontend/dist/assets/setting.json -# fi -# python3 serverSIO.py 8080 $config $model -# fi + cd /voice-changer-internal/voice-change-service + + cp -r /resources/* . + if [[ -e ./setting.json ]]; then + cp ./setting.json ../frontend/dist/assets/setting.json + fi + echo "-----------!!" + echo $config $model + echo $model + python3 serverSIO.py 8080 $config $model +fi diff --git a/trainer/setup.sh b/trainer/setup.sh index 4e869938..364ec539 100644 --- a/trainer/setup.sh +++ b/trainer/setup.sh @@ -14,5 +14,7 @@ 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 "$@" +# echo "parameter: $@" +# exec /usr/sbin/gosu user /bin/bash exec.sh "$@" +/bin/bash + diff --git a/vc_resources/.gitignore b/vc_resources/.gitignore new file mode 100644 index 00000000..d6b7ef32 --- /dev/null +++ b/vc_resources/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore