From 5021519fef7516b3e0cc24217587cd631a9cd2c7 Mon Sep 17 00:00:00 2001 From: Bingsu Date: Sat, 7 Oct 2023 13:06:13 +0900 Subject: [PATCH] fix: check hf download failure --- adetailer/__version__.py | 2 +- adetailer/common.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/adetailer/__version__.py b/adetailer/__version__.py index 88729b7..9d08e17 100644 --- a/adetailer/__version__.py +++ b/adetailer/__version__.py @@ -1 +1 @@ -__version__ = "23.9.3" +__version__ = "23.10.0.dev0" diff --git a/adetailer/common.py b/adetailer/common.py index a29bdd5..3bf81cb 100644 --- a/adetailer/common.py +++ b/adetailer/common.py @@ -10,6 +10,7 @@ from PIL import Image, ImageDraw from rich import print repo_id = "Bingsu/adetailer" +_download_failed = False @dataclass @@ -20,12 +21,18 @@ class PredictOutput: def hf_download(file: str): + global _download_failed + + if _download_failed: + return "INVALID" + try: path = hf_hub_download(repo_id, file) except Exception: msg = f"[-] ADetailer: Failed to load model {file!r} from huggingface" print(msg) path = "INVALID" + _download_failed = True return path