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:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user