1
0
mirror of https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI.git synced 2026-06-05 01:10:22 +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

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