diff --git a/Colab_RealtimeVoiceChanger.ipynb b/Colab_RealtimeVoiceChanger.ipynb index ebf87f6c6..50f461cbe 100644 --- a/Colab_RealtimeVoiceChanger.ipynb +++ b/Colab_RealtimeVoiceChanger.ipynb @@ -19,31 +19,28 @@ "\n", "## **READ ME - VERY IMPORTANT**\n", "\n", - "You can use the following settings for better results:\n", + "You can use the following settings for optimal results:\n", "\n", - "If you're using a index: `f0: RMVPE_ONNX | Chunk: 40 or higher | Extra: 131072`\\\n", - "If you're not using a index: `f0: RMVPE_ONNX | Chunk: 32 or higher | Extra: 131072`\\\n", + "Best performance: `f0: fcpe | Chunk: 64.0ms or higher | Extra: 2.7s`
\n", + "Best quality: `f0: rmvpe | Chunk: 72.0ms or higher | Extra: 5s`
\n", "**Don't forget to select your Colab GPU in the GPU field (Tesla T4, for free users)*\n", "\n", - "*You can always [click here](https://rentry.co/VoiceChangerGuide#gpu-chart-for-known-working-chunkextra\n", - ") to check if these settings are up-to-date*\n", + "You can tune `Chunk` for lower/higher delay and `Extra` for better quality.\n", + "\n", + "*You can always [click here](https://rentry.co/VoiceChangerGuide#gpu-chart-for-known-working-chunkextra) to check if these settings are up-to-date*\n", "

\n", "\n", "---\n", "\n", - "###Always use Colab GPU (**VERY VERY VERY IMPORTANT!**)\n", + "### Always use Colab GPU (**VERY VERY VERY IMPORTANT!**)\n", "You need to use a Colab GPU so the Voice Changer can work faster and better\\\n", "Use the menu above and click on **Runtime** » **Change runtime** » **Hardware acceleration** to select a GPU (**T4 is the free one**)\n", "\n", "---\n", "\n", - "
\n", - "\n", "# **Credits and Support**\n", - "Realtime Voice Changer by [w-okada](https://github.com/w-okada)\\\n", - "Colab files updated by [rafacasari](https://github.com/Rafacasari)\\\n", - "Recommended settings by [Raven](https://github.com/ravencutie21)\\\n", - "Modified again by [Hina](https://github.com/HinaBl)\n", + "Realtime Voice Changer by [w-okada](https://github.com/w-okada)
\n", + "Original instructions by [Hina](https://github.com/HinaBl)
\n", "\n", "Need help? [AI Hub Discord](https://discord.gg/aihub) » ***#help-realtime-vc***\n", "\n", @@ -107,19 +104,18 @@ "# if not os.path.exists('/content/voice-changer/server/stored_settings.json'):\n", "# !wget -q https://raw.githubusercontent.com/deiteris/voice-changer/master-custom/presets/colab.json -O /content/voice-changer/server/stored_settings.json\n", "\n", - "if Use_Drive==True:\n", - " if not os.path.exists('/content/drive'):\n", - " drive.mount('/content/drive')\n", + "if Use_Drive and not os.path.exists('/content/drive'):\n", + " drive.mount('/content/drive')\n", "\n", - " !mkdir -p /content/drive/MyDrive/voice-changer/server/model_dir\n", - " !mkdir -p /content/drive/MyDrive/voice-changer/server/pretrain\n", - " !rm -rf /content/voice-changer/server/model_dir\n", - " !rm -rf /content/voice-changer/server/pretrain\n", + " !mkdir -p /content/drive/MyDrive/voice-changer/server/model_dir\n", + " !mkdir -p /content/drive/MyDrive/voice-changer/server/pretrain\n", + " !rm -rf /content/voice-changer/server/model_dir\n", + " !rm -rf /content/voice-changer/server/pretrain\n", "\n", - " time.sleep(5)\n", + " time.sleep(5)\n", "\n", - " os.symlink(\"/content/drive/MyDrive/voice-changer/server/model_dir\", \"/content/voice-changer/server/model_dir\", True)\n", - " os.symlink(\"/content/drive/MyDrive/voice-changer/server/pretrain\", \"/content/voice-changer/server/pretrain\", True)\n", + " os.symlink(\"/content/drive/MyDrive/voice-changer/server/model_dir\", \"/content/voice-changer/server/model_dir\", True)\n", + " os.symlink(\"/content/drive/MyDrive/voice-changer/server/pretrain\", \"/content/voice-changer/server/pretrain\", True)\n", "\n", "print(f\"{Fore.GREEN}> Successfully cloned the repository!{Style.RESET_ALL}\")\n", "\n", @@ -131,9 +127,7 @@ "!pip install pyngrok --quiet\n", "print(f\"{Fore.CYAN}> Installing dependencies from requirements.txt...{Style.RESET_ALL}\")\n", "!pip install --upgrade -r requirements-common.txt -r requirements-cuda.txt --quiet\n", - "print(f\"{Fore.GREEN}> Successfully installed all packages!{Style.RESET_ALL}\")\n", - "\n", - "Run_Cell=1" + "print(f\"{Fore.GREEN}> Successfully installed all packages!{Style.RESET_ALL}\")" ] }, { diff --git a/Kaggle_RealtimeVoiceChanger.ipynb b/Kaggle_RealtimeVoiceChanger.ipynb index a2b695489..a7983c515 100644 --- a/Kaggle_RealtimeVoiceChanger.ipynb +++ b/Kaggle_RealtimeVoiceChanger.ipynb @@ -22,19 +22,20 @@ "\n", "## **⬇ VERY IMPORTANT ⬇**\n", "\n", - "You can use the following settings for better results:\n", + "You can use the following settings for optimal results:\n", "\n", - "If you're using a index: `f0: RMVPE_ONNX | Chunk: 40 or higher | Extra: 131072`
\n", - "If you're not using a index: `f0: RMVPE_ONNX | Chunk: 32 or higher | Extra: 131072`
\n", + "Best performance: `f0: fcpe | Chunk: 56.0ms or higher | Extra: 2.7s`
\n", + "Best quality: `f0: rmvpe | Chunk: 64.0ms or higher | Extra: 5s`
\n", "**Don't forget to select a GPU in the GPU field, NEVER use CPU!\n", "\n", + "You can tune `Chunk` for lower/higher delay and `Extra` for better quality.\n", + "\n", "*You can always [click here](https://github.com/YunaOneeChan/Voice-Changer-Settings) to check if these settings are up-to-date*\n", "\n", "---\n", "**Credits**
\n", - "Realtime Voice Changer by [w-okada](https://github.com/w-okada)
\n", - "Notebook files updated by [rafacasari](https://github.com/Rafacasari)
\n", - "Recommended settings by [YunaOneeChan](https://github.com/YunaOneeChan)\n", + "Realtime Voice Changer by [w-okada](https://github.com/w-okada)\n", + "Original instructions by [Hina](https://github.com/HinaBl)\n", "\n", "**Need help?** [AI Hub Discord](https://discord.gg/aihub) » ***#help-realtime-vc***\n", "\n", diff --git a/server/const.py b/server/const.py index 67091881e..20f1250db 100644 --- a/server/const.py +++ b/server/const.py @@ -91,13 +91,11 @@ def getSampleJsonAndModelIds(mode: RVCSampleMode): if mode == "production": return [ "https://huggingface.co/wok000/vcclient_model/raw/main/samples_0004_t.json", - "https://huggingface.co/wok000/vcclient_model/raw/main/samples_0004_o.json", - "https://huggingface.co/wok000/vcclient_model/raw/main/samples_0004_d.json", ], [ - ("Tsukuyomi-chan_o", {"useIndex": False}), - ("Amitaro_o", {"useIndex": False}), - ("KikotoMahiro_o", {"useIndex": False}), - ("TokinaShigure_o", {"useIndex": False}), + ("Tsukuyomi-chan_t", {"useIndex": False}), + ("Amitaro_t", {"useIndex": False}), + ("KikotoMahiro_t", {"useIndex": False}), + ("TokinaShigure_t", {"useIndex": False}), ] elif mode == "testAll": return [ @@ -192,6 +190,4 @@ def getSampleJsonAndModelIds(mode: RVCSampleMode): else: return [], [] - -RVC_MODEL_DIRNAME = "rvc" MAX_SLOT_NUM = 500 diff --git a/server/voice_changer/RVC/inferencer/RVCInferencerv2.py b/server/voice_changer/RVC/inferencer/RVCInferencerv2.py index 84949be7e..e87a0142d 100644 --- a/server/voice_changer/RVC/inferencer/RVCInferencerv2.py +++ b/server/voice_changer/RVC/inferencer/RVCInferencerv2.py @@ -16,7 +16,7 @@ def load_model(self, file: str): self.set_props(EnumInferenceTypes.pyTorchRVCv2, file) # Keep torch.load for backward compatibility, but discourage the use of this loading method - if '.safetensors' in file: + if file.endswith('.safetensors'): with safe_open(file, 'pt', device=str(dev) if dev.type == 'cuda' else 'cpu') as cpt: config = json.loads(cpt.metadata()['config']) model = SynthesizerTrnMs768NSFsid(*config, is_half=is_half).to(dev) diff --git a/server/voice_changer/RVC/inferencer/RVCInferencerv2Nono.py b/server/voice_changer/RVC/inferencer/RVCInferencerv2Nono.py index 58fc777f1..bbb09122b 100644 --- a/server/voice_changer/RVC/inferencer/RVCInferencerv2Nono.py +++ b/server/voice_changer/RVC/inferencer/RVCInferencerv2Nono.py @@ -16,7 +16,7 @@ def load_model(self, file: str): self.set_props(EnumInferenceTypes.pyTorchRVCv2Nono, file, is_half) # Keep torch.load for backward compatibility, but discourage the use of this loading method - if '.safetensors' in file: + if file.endswith('.safetensors'): with safe_open(file, 'pt', device=str(dev) if dev.type == 'cuda' else 'cpu') as cpt: config = json.loads(cpt.metadata()['config']) model = SynthesizerTrnMs768NSFsid_nono(*config, is_half=is_half).to(dev) diff --git a/server/voice_changer/RVC/onnxExporter/export2onnx.py b/server/voice_changer/RVC/onnxExporter/export2onnx.py index 2459821d4..036e11d68 100644 --- a/server/voice_changer/RVC/onnxExporter/export2onnx.py +++ b/server/voice_changer/RVC/onnxExporter/export2onnx.py @@ -42,7 +42,7 @@ def _export2onnx(input_model: str, output_model_simple: str, metadata: dict): if dev.type == 'privateuseone': dev = torch.device('cpu') is_half = False - is_safetensors = '.safetensors' in input_model + is_safetensors = input_model.endswith('.safetensors') if is_safetensors: cpt = safetensors.safe_open(input_model, 'pt', device=str(dev)) diff --git a/server/voice_changer/common/rmvpe/rmvpe.py b/server/voice_changer/common/rmvpe/rmvpe.py index 305ea0994..37ea4fde0 100644 --- a/server/voice_changer/common/rmvpe/rmvpe.py +++ b/server/voice_changer/common/rmvpe/rmvpe.py @@ -336,7 +336,7 @@ def __init__(self, model_path: str, is_half: bool, device: torch.device | str = device = 'cuda' if torch.cuda.is_available() else 'cpu' model = E2E(4, 1, (2, 2)) - if '.safetensors' in model_path: + if model_path.endswith('.safetensors'): with safe_open(model_path, 'pt', device=str(device) if device.type == 'cuda' else 'cpu') as cpt: load_model(model, cpt, strict=False) else: