Skip to content

Commit 730e01e

Browse files
authored
Sync cache version check from transformers (#3179)
sync cache version check from transformers
1 parent 0d196f9 commit 730e01e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/diffusers/utils/hub_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,10 @@ def move_cache(old_cache_dir: Optional[str] = None, new_cache_dir: Optional[str]
199199
cache_version = 0
200200
else:
201201
with open(cache_version_file) as f:
202-
cache_version = int(f.read())
202+
try:
203+
cache_version = int(f.read())
204+
except ValueError:
205+
cache_version = 0
203206

204207
if cache_version < 1:
205208
old_cache_is_not_empty = os.path.isdir(old_diffusers_cache) and len(os.listdir(old_diffusers_cache)) > 0

0 commit comments

Comments
 (0)