Created
June 1, 2023 02:40
-
-
Save ouor/01558698d634dae0da79bea66d60f23b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"id": "7ed98a91-70c3-4bd0-922b-7d10fc12496e", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Cloning into 'rvc-webui'...\n", | |
"remote: Enumerating objects: 1471, done.\u001b[K\n", | |
"remote: Counting objects: 100% (810/810), done.\u001b[K\n", | |
"remote: Compressing objects: 100% (193/193), done.\u001b[K\n", | |
"remote: Total 1471 (delta 670), reused 701 (delta 615), pack-reused 661\u001b[K\n", | |
"Receiving objects: 100% (1471/1471), 12.42 MiB | 26.17 MiB/s, done.\n", | |
"Resolving deltas: 100% (889/889), done.\n", | |
"/workspace/rvc-webui\n", | |
"\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n", | |
"\u001b[0m\n", | |
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.0.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.1.2\u001b[0m\n", | |
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpython -m pip install --upgrade pip\u001b[0m\n", | |
"Hit:1 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal InRelease\n", | |
"Hit:2 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 InRelease\n", | |
"Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB] \u001b[33m\n", | |
"Hit:4 http://archive.ubuntu.com/ubuntu focal InRelease \u001b[0m\n", | |
"Get:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]\n", | |
"Get:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]3m\u001b[33m\u001b[33m\u001b[33m\n", | |
"Get:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [3252 kB]\n", | |
"Get:8 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1351 kB]\n", | |
"Fetched 4938 kB in 2s (2988 kB/s)3m \u001b[0m\u001b[33m\u001b[33m\n", | |
"Reading package lists... Done\n", | |
"Building dependency tree \n", | |
"Reading state information... Done\n", | |
"48 packages can be upgraded. Run 'apt list --upgradable' to see them.\n", | |
"Reading package lists... Done\n", | |
"Building dependency tree \n", | |
"Reading state information... Done\n", | |
"ffmpeg is already the newest version (7:4.2.7-0ubuntu0.1).\n", | |
"0 upgraded, 0 newly installed, 0 to remove and 48 not upgraded.\n", | |
"Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (2.28.2)\n", | |
"Requirement already satisfied: bs4 in /usr/local/lib/python3.10/dist-packages (0.0.1)\n", | |
"Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (4.65.0)\n", | |
"Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests) (2019.11.28)\n", | |
"Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python3/dist-packages (from requests) (1.25.8)\n", | |
"Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests) (3.1.0)\n", | |
"Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from requests) (2.8)\n", | |
"Requirement already satisfied: beautifulsoup4 in /usr/local/lib/python3.10/dist-packages (from bs4) (4.12.0)\n", | |
"Requirement already satisfied: soupsieve>1.2 in /usr/local/lib/python3.10/dist-packages (from beautifulsoup4->bs4) (2.4)\n", | |
"\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n", | |
"\u001b[0m\n", | |
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.0.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.1.2\u001b[0m\n", | |
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpython -m pip install --upgrade pip\u001b[0m\n" | |
] | |
} | |
], | |
"source": [ | |
"! git clone https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI rvc-webui\n", | |
"%cd rvc-webui\n", | |
"! pip install -r requirements.txt -q\n", | |
"! apt update\n", | |
"! apt install ffmpeg -y\n", | |
"! pip install requests bs4 tqdm" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"id": "2797c27b-65ca-4fc0-ba25-70f7abda171e", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"/workspace/rvc-webui\n", | |
"Start downloading pretrained_v0\n" | |
] | |
}, | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"Downloading: pretrained_v0: 100%|██████████| 13/13 [00:15<00:00, 1.21s/it]\n" | |
] | |
}, | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Start downloading pretrained_v2\n" | |
] | |
}, | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"Downloading: pretrained_v2: 100%|██████████| 4/4 [00:05<00:00, 1.37s/it]\n" | |
] | |
}, | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Start downloading uvr5_weights\n" | |
] | |
}, | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"Downloading: uvr5_weights: 100%|██████████| 8/8 [00:07<00:00, 1.07it/s]\n" | |
] | |
} | |
], | |
"source": [ | |
"import os\n", | |
"import requests\n", | |
"from tqdm import tqdm\n", | |
"from bs4 import BeautifulSoup as bs\n", | |
"\n", | |
"def get_file_links(url):\n", | |
" r = requests.get(url)\n", | |
" file_links = bs(r.text, 'html.parser').find_all('li')\n", | |
" file_links = ['https://huggingface.co'+link.find('a', {'title':'Download file'}).attrs['href'] for link in file_links if link.find('a', {'title':'Download file'})]\n", | |
" return file_links\n", | |
"\n", | |
"def download_file(url, save_dir='.', pass_if_exists=True):\n", | |
" filename = url.split('/')[-1]\n", | |
" r = requests.get(url, allow_redirects=True)\n", | |
" download_path = os.path.join(save_dir, filename)\n", | |
" if pass_if_exists and os.path.exists(download_path): return\n", | |
" open(download_path, 'wb').write(r.content)\n", | |
" \n", | |
"print(os.getcwd())\n", | |
"\n", | |
"urls = (\n", | |
" 'https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/pretrained_v0',\n", | |
" 'https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/pretrained_v2',\n", | |
" 'https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/uvr5_weights',\n", | |
")\n", | |
"\n", | |
"for url in urls:\n", | |
" file_links = get_file_links(url)\n", | |
" save_dir = url.split('/')[-1]\n", | |
" print(f'Start downloading {save_dir}')\n", | |
" if not os.path.isdir(save_dir): os.makedirs(save_dir)\n", | |
" for link in tqdm(file_links, desc=f'Downloading: {save_dir}'):\n", | |
" download_file(link, save_dir=save_dir)\n", | |
"\n", | |
"url = 'https://huggingface.co/spaces/ardha27/rvc-models/resolve/main/hubert_base.pt'\n", | |
"\n", | |
"download_file(url, save_dir='.')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"id": "caa94121-020d-4091-8759-999e25fb372a", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Use Language: en_US\n", | |
"Running on local URL: http://127.0.0.1:7860\n", | |
"Running on public URL: https://4af1266abaef75d199.gradio.live\n", | |
"\n", | |
"This share link expires in 72 hours. For free permanent hosting and GPU upgrades (NEW!), check out Spaces: https://huggingface.co/spaces\n", | |
"^C\n", | |
"Keyboard interruption in main thread... closing server.\n", | |
"Killing tunnel 127.0.0.1:7860 <> https://4af1266abaef75d199.gradio.live\n" | |
] | |
} | |
], | |
"source": [ | |
"! python infer-web.py --colab" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3 (ipykernel)", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.10.10" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment