From 60cdc2029e427b7e7809f12e8caddd2c321a95dd Mon Sep 17 00:00:00 2001 From: Mangio621 Date: Thu, 4 May 2023 04:59:10 +1000 Subject: [PATCH] Created makefile and paperspace arguments for paperspace integration. Testing will occur soon. --- Makefile | 37 +++++++++++++++++++++++++++++++++++++ config.py | 7 ++++++- infer-web.py | 2 +- 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ab23ed1 --- /dev/null +++ b/Makefile @@ -0,0 +1,37 @@ +.PHONY: +.ONESHELL: + +help: ## Show this help and exit + @grep -hE '^[A-Za-z0-9_ \-]*?:.*##.*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +install: ## Install dependencies + apt-get -y install build-essential python3-dev ffmpeg + pip install --upgrade setuptools wheel + pip install --upgrade pip + pip install faiss-gpu fairseq gradio ffmpeg ffmpeg-python praat-parselmouth pyworld numpy==1.23.5 numba==0.56.4 librosa==0.9.2 + pip install -r requirements.txt + pip install --upgrade lxml + apt-get update + apt -y install -qq aria2 + +base: ## Download base files + mkdir -p pretrained uvr5_weights + git pull + aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/D32k.pth -d pretrained -o D32k.pth + aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/D40k.pth -d pretrained -o D40k.pth + aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/D48k.pth -d pretrained -o D48k.pth + aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/G32k.pth -d pretrained -o G32k.pth + aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/G40k.pth -d pretrained -o G40k.pth + aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/G48k.pth -d pretrained -o G48k.pth + aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0D32k.pth -d pretrained -o f0D32k.pth + aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0D40k.pth -d pretrained -o f0D40k.pth + aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0D48k.pth -d pretrained -o f0D48k.pth + aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0G32k.pth -d pretrained -o f0G32k.pth + aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0G40k.pth -d pretrained -o f0G40k.pth + aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained/f0G48k.pth -d pretrained -o f0G48k.pth + aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/uvr5_weights/HP2-人声vocals+非人声instrumentals.pth -d uvr5_weights -o HP2-人声vocals+非人声instrumentals.pth + aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/uvr5_weights/HP5-主旋律人声vocals+其他instrumentals.pth -d uvr5_weights -o HP5-主旋律人声vocals+其他instrumentals.pth + aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/hubert_base.pt -d ./ -o hubert_base.pt + +run: ## Run the python GUI + python infer-web.py --colab --pycmd python \ No newline at end of file diff --git a/config.py b/config.py index c99d370..83b77b8 100644 --- a/config.py +++ b/config.py @@ -19,6 +19,7 @@ class Config: self.noparallel, self.noautoopen, self.use_gfloat, + self.paperspace, ) = self.arg_parse() if self.use_gfloat: @@ -43,7 +44,10 @@ class Config: ) parser.add_argument( # this argument (if set to false) allows windows users to avoid the "slow_conv2d_cpu not implemented for 'Half'" exception "--use_gfloat", action="store_true", help="Will use g_float instead of g_half during voice conversion." - ) + ) + parser.add_argument( # Fork Feature. Paperspace integration for web UI + "--paperspace", action="store_true", help="Note that this argument just shares a gradio link for the web UI. Thus can be used on other non-local CLI systems." + ) cmd_opts = parser.parse_args() cmd_opts.port = cmd_opts.port if 0 <= cmd_opts.port <= 65535 else 7865 @@ -55,6 +59,7 @@ class Config: cmd_opts.noparallel, cmd_opts.noautoopen, cmd_opts.use_gfloat, + cmd_opts.paperspace, ) def device_config(self) -> tuple: diff --git a/infer-web.py b/infer-web.py index c61dd8d..6d2cf96 100644 --- a/infer-web.py +++ b/infer-web.py @@ -1537,7 +1537,7 @@ with gr.Blocks() as app: # with gr.TabItem(i18n("点击查看交流、问题反馈群号")): # gr.Markdown(value=i18n("xxxxx")) - if config.iscolab: + if config.iscolab or config.paperspace: # Share gradio link for colab and paperspace (FORK FEATURE) app.queue(concurrency_count=511, max_size=1022).launch(share=True) else: app.queue(concurrency_count=511, max_size=1022).launch(