Skip to content

Commit

Permalink
Update check of core deps (#24277)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgugger authored Jun 14, 2023
1 parent c4fec38 commit 8978b69
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/transformers/dependency_versions_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,21 @@
# order specific notes:
# - tqdm must be checked before tokenizers

pkgs_to_check_at_runtime = "python tqdm regex requests packaging filelock numpy tokenizers".split()
if sys.version_info < (3, 7):
pkgs_to_check_at_runtime.append("dataclasses")
pkgs_to_check_at_runtime = [
"python",
"tqdm",
"regex",
"requests",
"packaging",
"filelock",
"numpy",
"tokenizers",
"huggingface-hub",
"safetensors",
"accelerate",
"pyyaml",
]

if sys.version_info < (3, 8):
pkgs_to_check_at_runtime.append("importlib_metadata")

Expand All @@ -37,6 +49,14 @@

if not is_tokenizers_available():
continue # not required, check version only if installed
elif pkg == "accelerate":
# must be loaded here, or else tqdm check may fail
from .utils import is_accelerate_available

# Maybe switch to is_torch_available in the future here so that Accelerate is hard dep of
# Transformers with PyTorch
if not is_accelerate_available():
continue # not required, check version only if installed

require_version_core(deps[pkg])
else:
Expand Down

0 comments on commit 8978b69

Please sign in to comment.