1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-29 07:22:12 +03:00

Sync cache version check from transformers (#3179)

sync cache version check from transformers
This commit is contained in:
Yuchen Fan
2023-04-25 08:18:25 -05:00
committed by Daniel Gu
parent 9e2f445125
commit 81950af961

View File

@@ -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