mirror of
https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI.git
synced 2026-06-05 01:10:22 +08:00
feat(rvcmd): add dns and dl link fallback
This commit is contained in:
2
.github/workflows/unitest.yml
vendored
2
.github/workflows/unitest.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt -y install ffmpeg
|
sudo apt -y install ffmpeg
|
||||||
wget https://github.com/RVC-Project/RVC-Models-Downloader/releases/download/v0.2.1/rvcmd_linux_amd64.deb
|
wget https://github.com/RVC-Project/RVC-Models-Downloader/releases/download/v0.2.2/rvcmd_linux_amd64.deb
|
||||||
sudo apt -y install ./rvcmd_linux_amd64.deb
|
sudo apt -y install ./rvcmd_linux_amd64.deb
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
python -m pip install --upgrade setuptools
|
python -m pip install --upgrade setuptools
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
runtime\python.exe gui_v1.py --pycmd runtime\python.exe --dml
|
runtime\python.exe gui_v1.py --pycmd runtime\python.exe --nocheck --dml
|
||||||
pause
|
pause
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
runtime\python.exe gui_v1.py
|
runtime\python.exe --nocheck gui_v1.py
|
||||||
pause
|
pause
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
runtime\python.exe infer-web.py --pycmd runtime\python.exe --port 7897 --dml
|
runtime\python.exe infer-web.py --pycmd runtime\python.exe --nocheck --port 7897 --dml
|
||||||
pause
|
pause
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
runtime\python.exe infer-web.py --pycmd runtime\python.exe --port 7897
|
runtime\python.exe infer-web.py --pycmd runtime\python.exe --nocheck --port 7897
|
||||||
pause
|
pause
|
||||||
|
|||||||
11
infer-web.py
11
infer-web.py
@@ -13,7 +13,6 @@ from infer.lib.train.process_ckpt import (
|
|||||||
merge,
|
merge,
|
||||||
show_info,
|
show_info,
|
||||||
)
|
)
|
||||||
from infer.lib.rvcmd import check_all_assets, download_all_assets
|
|
||||||
from i18n.i18n import I18nAuto
|
from i18n.i18n import I18nAuto
|
||||||
from configs.config import Config
|
from configs.config import Config
|
||||||
from sklearn.cluster import MiniBatchKMeans
|
from sklearn.cluster import MiniBatchKMeans
|
||||||
@@ -54,11 +53,13 @@ torch.manual_seed(114514)
|
|||||||
config = Config()
|
config = Config()
|
||||||
vc = VC(config)
|
vc = VC(config)
|
||||||
|
|
||||||
if not config.nocheck and not check_all_assets():
|
if not config.nocheck:
|
||||||
download_all_assets(tmpdir=tmp)
|
from infer.lib.rvcmd import check_all_assets, download_all_assets
|
||||||
if not check_all_assets():
|
if not check_all_assets():
|
||||||
logging.error("counld not satisfy all assets needed.")
|
download_all_assets(tmpdir=tmp)
|
||||||
exit(1)
|
if not check_all_assets():
|
||||||
|
logging.error("counld not satisfy all assets needed.")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
if config.dml == True:
|
if config.dml == True:
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ def check_model(dir_name: Path, model_name: str, hash: str) -> bool:
|
|||||||
logger.info(f"{target} sha256 hash mismatch.")
|
logger.info(f"{target} sha256 hash mismatch.")
|
||||||
logger.info(f"expected: {hash}")
|
logger.info(f"expected: {hash}")
|
||||||
logger.info(f"real val: {digest}")
|
logger.info(f"real val: {digest}")
|
||||||
|
os.remove(str(target))
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -113,7 +114,7 @@ def download_and_extract_tar_gz(url: str, folder: str):
|
|||||||
import tarfile
|
import tarfile
|
||||||
|
|
||||||
logger.info(f"downloading {url}")
|
logger.info(f"downloading {url}")
|
||||||
response = requests.get(url, stream=True)
|
response = requests.get(url, stream=True, timeout=(5,10))
|
||||||
with BytesIO() as out_file:
|
with BytesIO() as out_file:
|
||||||
out_file.write(response.content)
|
out_file.write(response.content)
|
||||||
out_file.seek(0)
|
out_file.seek(0)
|
||||||
@@ -127,7 +128,7 @@ def download_and_extract_zip(url: str, folder: str):
|
|||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
logger.info(f"downloading {url}")
|
logger.info(f"downloading {url}")
|
||||||
response = requests.get(url)
|
response = requests.get(url, stream=True, timeout=(5,10))
|
||||||
with BytesIO() as out_file:
|
with BytesIO() as out_file:
|
||||||
out_file.write(response.content)
|
out_file.write(response.content)
|
||||||
out_file.seek(0)
|
out_file.seek(0)
|
||||||
@@ -136,8 +137,14 @@ def download_and_extract_zip(url: str, folder: str):
|
|||||||
zip_ref.extractall(folder)
|
zip_ref.extractall(folder)
|
||||||
logger.info(f"extracted into {folder}")
|
logger.info(f"extracted into {folder}")
|
||||||
|
|
||||||
|
def download_dns_yaml(url: str, folder: str):
|
||||||
|
logger.info(f"downloading {url}")
|
||||||
|
response = requests.get(url, stream=True, timeout=(5,10))
|
||||||
|
with open(f"{folder}/dns.yaml", "wb") as out_file:
|
||||||
|
out_file.write(response.content)
|
||||||
|
logger.info(f"downloaded into {folder}")
|
||||||
|
|
||||||
def download_all_assets(tmpdir: str, version="0.2.1"):
|
def download_all_assets(tmpdir: str, version="0.2.2"):
|
||||||
import subprocess
|
import subprocess
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
@@ -161,14 +168,35 @@ def download_all_assets(tmpdir: str, version="0.2.1"):
|
|||||||
if not architecture:
|
if not architecture:
|
||||||
logger.error(f"architecture {architecture} is not supported")
|
logger.error(f"architecture {architecture} is not supported")
|
||||||
exit(1)
|
exit(1)
|
||||||
BASE_URL = "https://github.com/RVC-Project/RVC-Models-Downloader/releases/download/"
|
try:
|
||||||
suffix = "zip" if is_win else "tar.gz"
|
BASE_URL = "https://github.com/RVC-Project/RVC-Models-Downloader/releases/download/"
|
||||||
RVCMD_URL = BASE_URL + f"v{version}/rvcmd_{system_type}_{architecture}.{suffix}"
|
suffix = "zip" if is_win else "tar.gz"
|
||||||
cmdfile = tmpdir + "/rvcmd"
|
RVCMD_URL = BASE_URL + f"v{version}/rvcmd_{system_type}_{architecture}.{suffix}"
|
||||||
if is_win:
|
cmdfile = tmpdir + "/rvcmd"
|
||||||
download_and_extract_zip(RVCMD_URL, tmpdir)
|
if is_win:
|
||||||
cmdfile += ".exe"
|
download_and_extract_zip(RVCMD_URL, tmpdir)
|
||||||
else:
|
cmdfile += ".exe"
|
||||||
download_and_extract_tar_gz(RVCMD_URL, tmpdir)
|
else:
|
||||||
os.chmod(cmdfile, 0o755)
|
download_and_extract_tar_gz(RVCMD_URL, tmpdir)
|
||||||
subprocess.run([cmdfile, "-notui", "-w", "0", "assets/all"])
|
os.chmod(cmdfile, 0o755)
|
||||||
|
subprocess.run([cmdfile, "-notui", "-w", "0", "assets/all"])
|
||||||
|
except Exception:
|
||||||
|
BASE_URL = "https://raw.gitcode.com/u011570312/RVC-Models-Downloader/assets/"
|
||||||
|
suffix = {
|
||||||
|
"darwin_amd64": "421",
|
||||||
|
"darwin_arm64": "422",
|
||||||
|
"linux_386": "423",
|
||||||
|
"linux_amd64": "424",
|
||||||
|
"linux_arm64": "425",
|
||||||
|
"windows_386": "426",
|
||||||
|
"windows_amd64": "427",
|
||||||
|
}[f"{system_type}_{architecture}"]
|
||||||
|
RVCMD_URL = BASE_URL + suffix
|
||||||
|
download_dns_yaml("https://raw.gitcode.com/u011570312/RVC-Models-Downloader/raw/main/dns.yaml", tmpdir)
|
||||||
|
if is_win:
|
||||||
|
download_and_extract_zip(RVCMD_URL, tmpdir)
|
||||||
|
cmdfile += ".exe"
|
||||||
|
else:
|
||||||
|
download_and_extract_tar_gz(RVCMD_URL, tmpdir)
|
||||||
|
os.chmod(cmdfile, 0o755)
|
||||||
|
subprocess.run([cmdfile, "-notui", "-w", "0", "-dns", f"{tmpdir}/dns.yaml", "assets/all"])
|
||||||
|
|||||||
@@ -94,7 +94,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# @title 下载安装 RVC-Models-Downloader\n",
|
"# @title 下载安装 RVC-Models-Downloader\n",
|
||||||
"!wget https://github.com/RVC-Project/RVC-Models-Downloader/releases/download/v0.2.1/rvcmd_linux_amd64.deb\n",
|
"!wget https://github.com/RVC-Project/RVC-Models-Downloader/releases/download/v0.2.2/rvcmd_linux_amd64.deb\n",
|
||||||
"!apt install ./rvcmd_linux_amd64.deb"
|
"!apt install ./rvcmd_linux_amd64.deb"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -350,4 +350,4 @@
|
|||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
"nbformat_minor": 0
|
"nbformat_minor": 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# @title 下载安装 RVC-Models-Downloader\n",
|
"# @title 下载安装 RVC-Models-Downloader\n",
|
||||||
"!wget https://github.com/RVC-Project/RVC-Models-Downloader/releases/download/v0.2.1/rvcmd_linux_amd64.deb\n",
|
"!wget https://github.com/RVC-Project/RVC-Models-Downloader/releases/download/v0.2.2/rvcmd_linux_amd64.deb\n",
|
||||||
"!apt install ./rvcmd_linux_amd64.deb"
|
"!apt install ./rvcmd_linux_amd64.deb"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -349,4 +349,4 @@
|
|||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
"nbformat_minor": 0
|
"nbformat_minor": 0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user