Unverified Commit 730e01ec authored by Yuchen Fan's avatar Yuchen Fan Committed by GitHub
Browse files

Sync cache version check from transformers (#3179)

sync cache version check from transformers
parent 0d196f9f
...@@ -199,7 +199,10 @@ if not os.path.isfile(cache_version_file): ...@@ -199,7 +199,10 @@ if not os.path.isfile(cache_version_file):
cache_version = 0 cache_version = 0
else: else:
with open(cache_version_file) as f: with open(cache_version_file) as f:
try:
cache_version = int(f.read()) cache_version = int(f.read())
except ValueError:
cache_version = 0
if cache_version < 1: if cache_version < 1:
old_cache_is_not_empty = os.path.isdir(old_diffusers_cache) and len(os.listdir(old_diffusers_cache)) > 0 old_cache_is_not_empty = os.path.isdir(old_diffusers_cache) and len(os.listdir(old_diffusers_cache)) > 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment