CoolFace
Apppublic

Aluode/PerceptionLabPortable

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
dependency_versions_check.py64 linesDownload Raw Back to transformers
1# Copyright 2020 The HuggingFace Team. All rights reserved.2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7#     http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14 15from .dependency_versions_table import deps16from .utils.versions import require_version, require_version_core17 18 19# define which module versions we always want to check at run time20# (usually the ones defined in `install_requires` in setup.py)21#22# order specific notes:23# - tqdm must be checked before tokenizers24 25pkgs_to_check_at_runtime = [26    "python",27    "tqdm",28    "regex",29    "requests",30    "packaging",31    "filelock",32    "numpy",33    "tokenizers",34    "huggingface-hub",35    "safetensors",36    "accelerate",37    "pyyaml",38]39 40for pkg in pkgs_to_check_at_runtime:41    if pkg in deps:42        if pkg == "tokenizers":43            # must be loaded here, or else tqdm check may fail44            from .utils import is_tokenizers_available45 46            if not is_tokenizers_available():47                continue  # not required, check version only if installed48        elif pkg == "accelerate":49            # must be loaded here, or else tqdm check may fail50            from .utils import is_accelerate_available51 52            # Maybe switch to is_torch_available in the future here so that Accelerate is hard dep of53            # Transformers with PyTorch54            if not is_accelerate_available():55                continue  # not required, check version only if installed56 57        require_version_core(deps[pkg])58    else:59        raise ValueError(f"can't find {pkg} in {deps.keys()}, check dependency_versions_table.py")60 61 62def dep_version_check(pkg, hint=None):63    require_version(deps[pkg], hint)64 
Aluode/PerceptionLabPortable · CoolFace