"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "afe8bfc0751000a2483eaa403b7bd7de020a9e80"
Unverified Commit 9b494a15 authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Don't hard error when cache version can't be converted to int (#22427)

parent 8252e24a
...@@ -1082,7 +1082,10 @@ if not os.path.isfile(cache_version_file): ...@@ -1082,7 +1082,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:
cache_version = int(f.read()) try:
cache_version = int(f.read())
except ValueError:
cache_version = 0
cache_is_not_empty = os.path.isdir(TRANSFORMERS_CACHE) and len(os.listdir(TRANSFORMERS_CACHE)) > 0 cache_is_not_empty = os.path.isdir(TRANSFORMERS_CACHE) and len(os.listdir(TRANSFORMERS_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