diff --git a/.gitignore b/.gitignore index 3ad1f0a0..2f51f5fb 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ server/memo.txt client/lib/dist client/lib/worklet/dist # client/demo/dist/ # demo用に残す + +docker/cudnn/ \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index 14e2955c..ec16c715 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,14 +1,15 @@ -FROM debian:bullseye-slim as base +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 apt-get install -y espeak -RUN apt-get install -y cmake +# RUN apt-get install -y espeak +# RUN apt-get install -y cmake -RUN pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113 +#RUN pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113 +RUN pip install torch torchvision torchaudio RUN pip install Cython==0.29.32 RUN pip install numpy==1.22.4 @@ -29,65 +30,41 @@ RUN pip install python-multipart==0.0.5 RUN pip install uvicorn==0.18.3 RUN pip install websockets==10.4 RUN pip install pyOpenSSL==23.0.0 +RUN pip install onnxruntime-gpu==1.13.1 -RUN pip install pyopenjtalk==0.2.0 -RUN pip install tensorboard==2.10.0 - -RUN git clone --depth 1 https://github.com/isletennos/MMVC_Trainer.git -b v1.3.1.3 +RUN git clone --depth 1 https://github.com/isletennos/MMVC_Trainer.git -b v1.3.2.2 WORKDIR /MMVC_Trainer/monotonic_align -RUN cythonize -3 -i core.pyx \ - && mv core.cpython-39-x86_64-linux-gnu.so monotonic_align/ +RUN python3 setup.py build_ext --inplace WORKDIR / ADD dummy / -RUN git clone https://github.com/w-okada/voice-changer.git -b v.1.3.0 +RUN git clone --depth 1 https://github.com/w-okada/voice-changer.git -b v.1.3.0 + + +#FROM debian:bullseye-slim +#FROM nvidia/cuda:12.0.0-runtime-ubuntu22.04 +FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 + -FROM debian:bullseye-slim RUN apt-get update \ - && apt-get install -y python3-pip espeak gosu libsndfile1-dev\ + && apt-get install -y python3-pip espeak gosu libsndfile1-dev emacs \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -# ### 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 - ### 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 /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_Trainer /voice-changer/server/MMVC_Trainer +RUN chmod 0777 /voice-changer/server/MMVC_Trainer +RUN chmod 0777 /voice-changer/server + +ADD /setup.sh /voice-changer/server +ADD /exec.sh /voice-changer/server -# # # ### Copy from frontend -# # # ##### MMVC Trainer -# # # COPY --from=front --chmod=777 /MMVC_Trainer /MMVC_Trainer -# # # RUN chmod 0777 /MMVC_Trainer - -# # # ADD /setup.sh /MMVC_Trainer/ -# # # ADD /exec.sh /MMVC_Trainer/ - -# # ##### Voice changer Internal -# # 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 - -# # ADD /setup.sh /voice-changer-internal/voice-change-service/ -# # ADD /exec.sh /voice-changer-internal/voice-change-service/ -# # COPY fine_model/G_180000.pth /voice-changer-internal/voice-change-service/MMVC_Trainer/fine_model/G_180000.pth -# # COPY fine_model/D_180000.pth /voice-changer-internal/voice-change-service/MMVC_Trainer/fine_model/D_180000.pth - -# # ## 歴史的な経緯でsetup.shをMMVC_Trainerに置いているのでそこを起動時のWORKDIRにしている。 -# # WORKDIR /voice-changer-internal/voice-change-service - -# # # ##### Soft VC -# # # COPY --from=front /hubert /hubert -# # # COPY --from=front /acoustic-model /acoustic-model -# # # COPY --from=front /hifigan /hifigan -# # # COPY --from=front /models /models - - -# # ENTRYPOINT ["/bin/bash", "setup.sh"] -# # CMD [ "-h"] +WORKDIR /voice-changer/server +ENTRYPOINT ["/bin/bash", "setup.sh"] +CMD [ "-h"] diff --git a/docker/exec.sh b/docker/exec.sh index fbe6751e..e0cd9426 100644 --- a/docker/exec.sh +++ b/docker/exec.sh @@ -13,16 +13,17 @@ echo "PARAMS: $PARAMS" # echo "VERBOSE: $VERBOSE" echo "------" -cd /voice-changer-internal/voice-change-service +#cd /voice-changer-internal/voice-change-service # 起動 if [ "${MODE}" = "MMVC" ] ; then - if [[ -e /resources/setting.json ]]; then - echo "指定された設定(setting.json)を使用します。" - cp /resources/setting.json ../frontend/dist/assets/setting.json - fi + # if [[ -e /resources/setting.json ]]; then + # echo "指定された設定(setting.json)を使用します。" + # cp /resources/setting.json ../frontend/dist/assets/setting.json + # fi - find /resources/ -type f -name "config.json" | xargs -I{} sh -c 'echo "config.jsonをコピーします。" && cp {} ./' + # find /resources/ -type f -name "config.json" | xargs -I{} sh -c 'echo "config.jsonをコピーします。" && cp {} ./' find /resources/ -type f -name "*.pth" | xargs -I{} sh -c 'echo "`basename {}`をコピーします。" && cp {} ./' + find /resources/ -type f -name "*.onnx" | xargs -I{} sh -c 'echo "`basename {}`をコピーします。" && cp {} ./' echo "MMVCを起動します" python3 MMVCServerSIO.py -t MMVC $PARAMS #2>stderr.txt diff --git a/server/voice_changer/VoiceChanger.py b/server/voice_changer/VoiceChanger.py index e5f91194..cc17e039 100755 --- a/server/voice_changer/VoiceChanger.py +++ b/server/voice_changer/VoiceChanger.py @@ -115,6 +115,8 @@ class VoiceChanger(): providers = self.onnx_session.get_providers() print("Providers:", providers) if "CUDAExecutionProvider" in providers: + if self.settings.gpu < 0 or self.settings.gpu >= self.gpu_num: + self.settings.gpu = 0 provider_options=[{'device_id': self.settings.gpu}] self.onnx_session.set_providers(providers=["CUDAExecutionProvider"], provider_options=provider_options) if key == "crossFadeOffsetRate" or key == "crossFadeEndRate":