Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colab WebUI #67

Open
wants to merge 48 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
ce008d5
Add files via upload
hinabl Sep 27, 2023
5def93d
Add files via upload
hinabl Sep 27, 2023
87f8b7c
Quick Update
hinabl Sep 29, 2023
94217db
Created using Colaboratory
hinabl Sep 29, 2023
6902c4b
I Forgot
hinabl Sep 29, 2023
b6b019c
Reverted to use 12 pitch instead of 1
hinabl Oct 7, 2023
1eb57fe
Reverted to use 12 instead of 1 on pitch
hinabl Oct 7, 2023
8202605
Reverted the pitch control to use 12 instead of 1
hinabl Oct 7, 2023
2965e98
Changed title(so people knows this is the modded version)
hinabl Oct 11, 2023
90fe6bd
Added random
hinabl Oct 22, 2023
e45c7d2
Changed Something :D
hinabl Oct 22, 2023
f542fb7
Update README.md
hinabl Oct 24, 2023
9e855e7
Switched back to -12 0 12 (might still be broken)
hinabl Oct 24, 2023
81fb630
Adding Toggle soon to either use 1 or 12 as pitch
hinabl Oct 24, 2023
afc4217
Added Pitch Change Toggle
hinabl Oct 25, 2023
e0706ea
Fixed small Issue
hinabl Oct 25, 2023
ee077b7
Ahh ye..
hinabl Oct 25, 2023
e0ebbfa
Added Install To Drive
hinabl Oct 29, 2023
a17272d
Removed Requirements that are not needed on colab
hinabl Oct 30, 2023
b1615c7
aforgot something...
hinabl Oct 30, 2023
a2faebf
Update requirements.txt
hinabl Nov 9, 2023
ef028c2
/n
hinabl Nov 9, 2023
16e731f
Random
hinabl Nov 9, 2023
40b55eb
Added Ngrok Option
hinabl Nov 10, 2023
94f0f61
Created using Colaboratory
hinabl Nov 10, 2023
36d7541
Created using Colaboratory
hinabl Nov 10, 2023
767b239
Changed Top
hinabl Nov 12, 2023
3aaa17d
Quick fix to colab updating cuda
hinabl Dec 16, 2023
048bd5a
Updated Credits
hinabl Dec 16, 2023
3f8664b
Fixed Ngrok not working
hinabl Jan 2, 2024
b9a1a57
Fallback Toggle
hinabl Jan 18, 2024
edfc3e9
Set UseFallback to default False
hinabl Jan 19, 2024
db8a752
Saved Backup
hinabl Jan 19, 2024
f7d6fbd
Temp Fix to Gradio on Colab
hinabl Jan 19, 2024
0b4f6de
Fixed Ngrok Port
hinabl Jan 21, 2024
153b8d5
Set UseFallback to False on default
hinabl Jan 22, 2024
b93f81e
FINALLY! Fixed cuda error
hinabl Feb 3, 2024
3e574c4
Added Cloudflared option on URL
hinabl Feb 6, 2024
e600712
Updated Gradio Client
hinabl Feb 7, 2024
87789c2
Updated gradio
hinabl Feb 9, 2024
c423746
changed np.int to int
hinabl Feb 15, 2024
55caa4e
RE: Fixed wrong path
hinabl Feb 15, 2024
e6ccbc9
Updated to work with Pitch 1
hinabl Feb 19, 2024
3fb2148
import os.. for reasons
hinabl Jun 16, 2024
6b80ba4
Updated pip
hinabl Jul 25, 2024
0d5f8ec
Downgrade
hinabl Jan 17, 2025
4b8eb8f
HotFix cuda broken
hinabl Jan 17, 2025
26ddd21
Downgraded Torch
hinabl Jan 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
263 changes: 263 additions & 0 deletions Hina_Mod_AICoverGen_colab.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/hinabl/AICoverGen-Colab/blob/main/Hina_Mod_AICoverGen_colab.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "YYVAKuNBc-X4"
},
"source": [
"\n",
"\n",
"# AICoverGen WebUI (Modded by [Hina](https://discordlookup.com/user/444684887363026974))\n",
"Original Repo by [SociallyIneptWeeb](https://github.com/SociallyIneptWeeb/AICoverGen)\n",
"\n",
"Additional Credits to: [Eddy](https://github.com/Eddycrack864) and [GDR](https://github.com/GatienDoesStuff) for finding a fix to colab update\n",
"\n",
"Please do credit if you do any modifications or translations to this colab notebook.\n",
"\n",
"Simply click `Runtime` in the top navigation bar and `Run all`. Wait for the output of the final cell to show the public gradio url and click on it."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "vC4gLMHI9xb3",
"cellView": "form"
},
"outputs": [],
"source": [
"#@title Clone repository\n",
"from IPython.display import clear_output, Javascript\n",
"import codecs\n",
"import threading\n",
"import time\n",
"import os # for reasons...\n",
"# cloneing=codecs.decode('uggcf://tvguho.pbz/uvanoy/NVPbireTra-Pbyno.tvg','rot_13')\n",
"credit = \" - This Notebook was originally modified by Hina\"\n",
"#=======================Auto Edit======================\n",
"\n",
"#@markdown ---\n",
"#@markdown Switch between ```-1 0 1``` or ```-12 0 12``` pitch change control\n",
"\n",
"#@markdown This can only be changed once, you need to restart the whole thing if you wanna change it again\n",
"Pitch_Change=\"12\" #@param ['1','12']\n",
"\n",
"##@markdown Enable if you want to install the Program to your Drive\n",
"if Pitch_Change==\"1\":\n",
" cloneing=codecs.decode('uggcf://tvguho.pbz/FbpvnyylVarcgJrro/NVPbireTra.tvg','rot_13')\n",
"else:\n",
" cloneing=codecs.decode('uggcf://tvguho.pbz/uvanoy/NVPbireTra-Pbyno.tvg','rot_13')\n",
"#=====================Auto Edit End================\n",
"# this doesnt work btw :D\n",
"Install_To_Drive=False\n",
"\n",
"\n",
"#====================Use Drive============\n",
"if Install_To_Drive==True:\n",
" from google.colab import drive\n",
" drive.mount('/content/drive')\n",
"\n",
" !git clone $cloneing Hina_RVC\n",
" !mv Hina_RVC /content/drive/MyDrive/\n",
" !rm -rf sample_data\n",
" %cd /content/drive/MyDrive/Hina_RVC\n",
"else:\n",
" !git clone $cloneing Hina_RVC\n",
" !rm -rf sample_data\n",
" %cd /content/\n",
" %cd Hina_RVC\n",
"\n",
"\n",
"def update_timer_and_print():\n",
" global timer\n",
" while True:\n",
" hours, remainder = divmod(timer, 3600)\n",
" minutes, seconds = divmod(remainder, 60)\n",
" timer_str = f'{hours:02}:{minutes:02}:{seconds:02}'\n",
" print(f'\\rTimer: {timer_str} ', end='', flush=True) # Print without a newline\n",
" time.sleep(1)\n",
" timer += 1\n",
"timer = 0\n",
"threading.Thread(target=update_timer_and_print, daemon=True).start()\n",
"\n",
"#@markdown ---\n",
"LongInstall=False #@param {type:\"boolean\"}\n",
"#@markdown When using LongInstall -> This cell may take a while to install, up to 15 minutes if unlucky\n",
"#@markdown <br><br>``NOTE! The L̲o̲n̲g̲I̲n̲s̲t̲a̲l̲l̲ toggle is only needed when it fails to use the GPU when making a cover``\n",
"if LongInstall==True:\n",
" !sudo apt update\n",
" !yes | sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install cuda-11-8\n",
" clear_output()\n",
" !find / -name '*libcublasLt.so*' #Just to see the versions, you will have 11.8 and 12.2\n",
" time.sleep(10)\n",
"\n",
"clear_output()\n",
"print(\"Done Cloning Repository\"+credit)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "odzpJHpr_PaF",
"cellView": "form"
},
"outputs": [],
"source": [
"#@title Install requirements\n",
"req=codecs.decode('erdhverzragf.gkg','rot_13')\n",
"pt=codecs.decode('fep/pbasvtf','rot_13')\n",
"#@markdown This cell can take up to 5 minutes to finish\n",
"!pip install uv\n",
"!uv venv --python 3.10.12 .venv\n",
"!uv pip install pip==23.3.1 > /dev/null 2>&1\n",
"\n",
"!uv pip install setuptools wheel ipykernel numpy onnxruntime-gpu onnxruntime > /dev/null 2>&1\n",
"\n",
"!uv pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 > /dev/null 2>&1\n",
"\n",
"clear_output()\n",
"if Pitch_Change==\"12\":\n",
" print(\"Using Pitch 12\")\n",
" %cd $pt\n",
" time.sleep(5)\n",
" !sed -i '/torch==/d' $req\n",
" !sed -i '/torchaudio==/d' $req\n",
" !sed -i '/numpy==/d' $req\n",
" !sed -i '/librosa==/d' $req\n",
" !sed -i '/Requests==/d' $req\n",
" !sed -i '/scipy==/d' $req\n",
" !sed -i '/soundfile==/d' $req\n",
" !sed -i '/tqdm==/d' $req\n",
"\n",
" time.sleep(5)\n",
" !uv pip install -r requirements.txt > /dev/null 2>&1\n",
" clear_output()\n",
"\n",
" # Fix Numpy deprecation\n",
" !sed -i 's/(np.int)/(int)/g' '../vc_infer_pipeline.py'\n",
" %cd ../../\n",
"else:\n",
" print(\"Using Pitch 1\")\n",
" time.sleep(5)\n",
" !sed -i '/torch==/d' $req\n",
" !sed -i '/torchaudio==/d' $req\n",
" !sed -i '/numpy==/d' $req\n",
" !sed -i '/librosa==/d' $req\n",
" !sed -i '/Requests==/d' $req\n",
" !sed -i '/scipy==/d' $req\n",
" !sed -i '/soundfile==/d' $req\n",
" !sed -i '/tqdm==/d' $req\n",
"\n",
" time.sleep(5)\n",
" !uv pip install -r requirements.txt > /dev/null 2>&1\n",
" clear_output()\n",
"\n",
" # Fix Numpy deprecation\n",
" !sed -i 's/(np.int)/(int)/g' 'src/vc_infer_pipeline.py'\n",
"!uv pip install gradio==3.48.0 > /dev/null 2>&1\n",
"\n",
"\n",
"\n",
"# install cuda fix\n",
"!uv pip install ort-nightly-gpu --index-url=https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ort-cuda-12-nightly/pypi/simple/ > /dev/null 2>&1\n",
"!uv pip install torch==2.0.1 > /dev/null 2>&1\n",
"# clear_output()\n",
"print(\"Finished Installing Requirements\")\n",
"!sudo apt update\n",
"# clear_output()\n",
"print(\"Finished Updating\")\n",
"!sudo apt install sox\n",
"clear_output()\n",
"models=codecs.decode('fep/qbjaybnq_zbqryf.cl','rot_13')\n",
"!python $models\n",
"clear_output()\n",
"print(\"Finished Downloading Voice Separation Model and Hubert Base Model\")\n",
"print(\"Finsihed running this cell, proceed to the next cell\"+credit)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "NEglTq6Ya9d0",
"cellView": "form"
},
"outputs": [],
"source": [
"#@title Run WebUI\n",
"#@markdown ---\n",
"runpice=codecs.decode('fep/jrohv.cl','rot_13')\n",
"Url=\"Gradio\" #@param ['Gradio','Ngrok','Cloudflared']\n",
"#@markdown ---\n",
"#@markdown - Token is only needed if you are using Ngrok. You can make an account on [ngrok](https://dashboard.ngrok.com/signup) for free.\n",
"#@markdown - Click [this link](https://dashboard.ngrok.com/get-started/your-authtoken) to get your auth token, and place it here:\n",
"Token=\"\" #@param {type:\"string\"}\n",
"if Url==\"Gradio\":\n",
" !source .venv/bin/activate; python $runpice --share\n",
"elif Url == \"Cloudflared\":\n",
" # Install Cloudflared\n",
" !curl -LO https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb\n",
" !dpkg -i cloudflared-linux-amd64.deb\n",
" # Delete log file\n",
" !rm -rf nohup.out\n",
" # Run cloudflared\n",
" !nohup cloudflared tunnel --url localhost:9999 &\n",
" clear_output()\n",
"\n",
" time.sleep(5)\n",
"\n",
" !grep -oE \"https://[a-zA-Z0-9.-]+\\.trycloudflare\\.com\" nohup.out\n",
" !source .venv/bin/activate; python $runpice --listen-port 9999\n",
"else:\n",
" !uv pip install pyngrok > /dev/null 2>&1\n",
" from pyngrok import ngrok\n",
" ngrok.set_auth_token(Token)\n",
" ngrok.kill()\n",
" cover_tunnel = ngrok.connect(9999)\n",
" print(\"CoverGen URL:\", cover_tunnel.public_url)\n",
" print(credit)\n",
" !source .venv/bin/activate; python $runpice --listen-port 9999"
]
},
{
"cell_type": "markdown",
"source": [
"[![](https://i.pinimg.com/474x/de/72/9e/de729ecfa41b69901c42c82fff752414.jpg)](https://discordlookup.com/user/444684887363026974)"
],
"metadata": {
"id": "npldkPdYfkrA"
}
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"gpuType": "T4",
"provenance": [],
"private_outputs": true,
"cell_execution_strategy": "setup",
"include_colab_link": true
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Then follow the instructions in the notebook to run the webui.

For those without a powerful enough NVIDIA GPU, you may try AICoverGen out using Google Colab.

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/SociallyIneptWeeb/AICoverGen/blob/main/AICoverGen_colab.ipynb)
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/hinabl/AICoverGen-Colab/blob/main/Hina_Mod_AICoverGen_colab.ipynb)

For those who face issues with Google Colab notebook disconnecting after a few minutes, here's an alternative that doesn't use the WebUI.

Expand Down
24 changes: 12 additions & 12 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ deemix
fairseq==0.12.2
faiss-cpu==1.7.3
ffmpeg-python>=0.2.0
gradio==3.39.0
lib==4.0.0
gradio==2.5.0
lib==2.0.0
librosa==0.9.1
numpy==1.23.5
numpy==1.15.0
onnxruntime_gpu
praat-parselmouth>=0.4.2
pedalboard==0.7.7
pydub==0.25.1
pyworld==0.3.4
Requests==2.31.0
scipy==1.11.1
soundfile==0.12.1
pedalboard==0.2.3
pydub==0.5.1
pyworld==0.3.1
Requests==1.1.0
scipy==1.4.1
soundfile==0.9.1
--find-links https://download.pytorch.org/whl/torch_stable.html
torch==2.0.1+cu118
torchcrepe==0.0.20
tqdm==4.65.0
torchcrepe==0.0.10
tqdm==4.1.0
yt_dlp==2023.7.6
sox==1.4.1
sox==1.2.1
22 changes: 22 additions & 0 deletions src/configs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
deemix
fairseq==0.12.2
faiss-cpu==1.7.3
ffmpeg-python>=0.2.0
gradio==3.39.0
lib==4.0.0
librosa==0.9.1
numpy==1.23.5
onnxruntime_gpu
praat-parselmouth>=0.4.2
pedalboard==0.7.7
pydub==0.25.1
pyworld==0.3.4
Requests==2.31.0
scipy==1.11.1
soundfile==0.12.1
--find-links https://download.pytorch.org/whl/torch_stable.html
torch==2.0.1+cu118
torchcrepe==0.0.20
tqdm==4.65.0
yt_dlp==2023.7.6
sox==1.4.1
4 changes: 2 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def song_cover_pipeline(song_input, voice_model, pitch_change, keep_files,
else:
orig_song_path, instrumentals_path, main_vocals_dereverb_path, backup_vocals_path = paths

pitch_change = pitch_change * 12 + pitch_change_all
# pitch_change = pitch_change + pitch_change_all
ai_vocals_path = os.path.join(song_dir, f'{os.path.splitext(os.path.basename(orig_song_path))[0]}_{voice_model}_p{pitch_change}_i{index_rate}_fr{filter_radius}_rms{rms_mix_rate}_pro{protect}_{f0_method}{"" if f0_method != "mangio-crepe" else f"_{crepe_hop_length}"}.wav')
ai_cover_path = os.path.join(song_dir, f'{os.path.splitext(os.path.basename(orig_song_path))[0]} ({voice_model} Ver).{output_format}')

Expand Down Expand Up @@ -320,7 +320,7 @@ def song_cover_pipeline(song_input, voice_model, pitch_change, keep_files,
parser = argparse.ArgumentParser(description='Generate a AI cover song in the song_output/id directory.', add_help=True)
parser.add_argument('-i', '--song-input', type=str, required=True, help='Link to a YouTube video or the filepath to a local mp3/wav file to create an AI cover of')
parser.add_argument('-dir', '--rvc-dirname', type=str, required=True, help='Name of the folder in the rvc_models directory containing the RVC model file and optional index file to use')
parser.add_argument('-p', '--pitch-change', type=int, required=True, help='Change the pitch of AI Vocals only. Generally, use 1 for male to female and -1 for vice-versa. (Octaves)')
parser.add_argument('-p', '--pitch-change', type=int, required=True, help='Change the pitch of AI Vocals only. Generally, use 12 for male to female and -12 for vice-versa. (Octaves)')
parser.add_argument('-k', '--keep-files', action=argparse.BooleanOptionalAction, help='Whether to keep all intermediate audio files generated in the song_output/id directory, e.g. Isolated Vocals/Instrumentals')
parser.add_argument('-ir', '--index-rate', type=float, default=0.5, help='A decimal number e.g. 0.5, used to reduce/resolve the timbre leakage problem. If set to 1, more biased towards the timbre quality of the training dataset')
parser.add_argument('-fr', '--filter-radius', type=int, default=3, help='A number between 0 and 7. If >=3: apply median filtering to the harvested pitch results. The value represents the filter radius and can reduce breathiness.')
Expand Down
6 changes: 3 additions & 3 deletions src/webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def show_hop_slider(pitch_detection_algo):

with gr.Blocks(title='AICoverGenWebUI') as app:

gr.Label('AICoverGen WebUI created with ❤️', show_label=False)
gr.Label('AICoverGen WebUI Modified For Colab/Kaggle ❤️', show_label=False)

# main tab
with gr.Tab("Generate"):
Expand All @@ -190,7 +190,7 @@ def show_hop_slider(pitch_detection_algo):
song_input_file.upload(process_file_upload, inputs=[song_input_file], outputs=[local_file, song_input])

with gr.Column():
pitch = gr.Slider(-3, 3, value=0, step=1, label='Pitch Change (Vocals ONLY)', info='Generally, use 1 for male to female conversions and -1 for vice-versa. (Octaves)')
pitch = gr.Slider(-20, 20, value=0, step=1, label='Pitch Change (Vocals ONLY)', info='Generally, use 12 for male to female conversions and -12 for vice-versa. (Octaves)')
pitch_all = gr.Slider(-12, 12, value=0, step=1, label='Overall Pitch Change', info='Changes pitch/key of vocals and instrumentals together. Altering this slightly reduces sound quality. (Semitones)')
show_file_upload_button.click(swap_visibility, outputs=[file_upload_col, yt_link_col, song_input, local_file])
show_yt_link_button.click(swap_visibility, outputs=[yt_link_col, file_upload_col, song_input, local_file])
Expand Down Expand Up @@ -318,5 +318,5 @@ def show_hop_slider(pitch_detection_algo):
share=args.share_enabled,
enable_queue=True,
server_name=None if not args.listen else (args.listen_host or '0.0.0.0'),
server_port=args.listen_port,
server_port=9999,
)
Loading