Unverified Commit 6a08162a authored by Keith Kjer's avatar Keith Kjer Committed by GitHub
Browse files

Fix cached lookup filepath on windows for hub (#19178)



* Update hub.py commit_hash extraction

Add safety mechanism for windows systems to unify logic (replace double backslashes with /)

* Fix string quotetype

* Aaaa circleci is messing with me.

* Switch to using as_posix() method from pathlib

* Update src/transformers/utils/hub.py
Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>

* Update src/transformers/utils/hub.py
Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
parent f33858d1
...@@ -222,7 +222,7 @@ def extract_commit_hash(resolved_file: Optional[str], commit_hash: Optional[str] ...@@ -222,7 +222,7 @@ def extract_commit_hash(resolved_file: Optional[str], commit_hash: Optional[str]
""" """
if resolved_file is None or commit_hash is not None: if resolved_file is None or commit_hash is not None:
return commit_hash return commit_hash
resolved_file = str(Path(resolved_file).as_posix())
search = re.search(r"snapshots/([^/]+)/", resolved_file) search = re.search(r"snapshots/([^/]+)/", resolved_file)
if search is None: if search is None:
return None return None
......
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