From 81950af9615ec6a1aa7f0ef24c1d368ef7ebb94a Mon Sep 17 00:00:00 2001 From: Yuchen Fan Date: Tue, 25 Apr 2023 08:18:25 -0500 Subject: [PATCH] Sync cache version check from transformers (#3179) sync cache version check from transformers --- src/diffusers/utils/hub_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/diffusers/utils/hub_utils.py b/src/diffusers/utils/hub_utils.py index 511763ec66..9cfc649c8b 100644 --- a/src/diffusers/utils/hub_utils.py +++ b/src/diffusers/utils/hub_utils.py @@ -199,7 +199,10 @@ if not os.path.isfile(cache_version_file): cache_version = 0 else: with open(cache_version_file) as f: - cache_version = int(f.read()) + try: + cache_version = int(f.read()) + except ValueError: + cache_version = 0 if cache_version < 1: old_cache_is_not_empty = os.path.isdir(old_diffusers_cache) and len(os.listdir(old_diffusers_cache)) > 0