1
0
mirror of https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI.git synced 2026-06-08 03:55:47 +08:00

optimize: error handling & update logics

This commit is contained in:
源文雨
2024-04-23 17:06:25 +09:00
parent da9a02049f
commit 1717645ae1
3 changed files with 23 additions and 14 deletions

View File

@@ -159,7 +159,7 @@ if __name__ == "__main__":
if not check_all_assets(update=self.config.update): if not check_all_assets(update=self.config.update):
if self.config.update: if self.config.update:
download_all_assets(tmpdir=tmp) download_all_assets(tmpdir=tmp)
if not check_all_assets(update=False): if not check_all_assets(update=self.config.update):
printt("counld not satisfy all assets needed.") printt("counld not satisfy all assets needed.")
exit(1) exit(1)

View File

@@ -60,7 +60,7 @@ if not config.nocheck:
if not check_all_assets(update=config.update): if not check_all_assets(update=config.update):
if config.update: if config.update:
download_all_assets(tmpdir=tmp) download_all_assets(tmpdir=tmp)
if not check_all_assets(update=False): if not check_all_assets(update=config.update):
logging.error("counld not satisfy all assets needed.") logging.error("counld not satisfy all assets needed.")
exit(1) exit(1)
@@ -1608,13 +1608,16 @@ with gr.Blocks(title="RVC WebUI") as app:
except: except:
gr.Markdown(traceback.format_exc()) gr.Markdown(traceback.format_exc())
if config.iscolab: try:
app.queue(max_size=1022).launch(share=True, max_threads=511) if config.iscolab:
else: app.queue(max_size=1022).launch(share=True, max_threads=511)
app.queue(max_size=1022).launch( else:
max_threads=511, app.queue(max_size=1022).launch(
server_name="0.0.0.0", max_threads=511,
inbrowser=not config.noautoopen, server_name="0.0.0.0",
server_port=config.listen_port, inbrowser=not config.noautoopen,
quiet=True, server_port=config.listen_port,
) quiet=True,
)
except Exception as e:
logger.error(str(e))

View File

@@ -28,13 +28,19 @@ def check_model(
return False return False
with open(target, "rb") as f: with open(target, "rb") as f:
digest = sha256(f) digest = sha256(f)
bakfile = f"{target}.bak"
if digest != hash: if digest != hash:
logger.info(f"{target} sha256 hash mismatch.") logger.warn(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}")
logger.warn("please add parameter --update to download the latest assets.")
if remove_incorrect: if remove_incorrect:
os.remove(str(target)) if not os.path.exists(bakfile):
os.rename(str(target), bakfile)
else: os.remove(str(target))
return False return False
if remove_incorrect and os.path.exists(bakfile):
os.remove(bakfile)
return True return True