MCPcopy
hub / github.com/huggingface/transformers / check_missing_backends

Function check_missing_backends

utils/check_repo.py:590–612  ·  view source on GitHub ↗

Checks if all backends are installed (otherwise the check of this script is incomplete). Will error in the CI if that's not the case but only throw a warning for users running this.

()

Source from the content-addressed store, hash-verified

588
589
590def check_missing_backends():
591 """
592 Checks if all backends are installed (otherwise the check of this script is incomplete). Will error in the CI if
593 that's not the case but only throw a warning for users running this.
594 """
595 missing_backends = []
596 if not is_torch_available():
597 missing_backends.append("PyTorch")
598
599 if len(missing_backends) > 0:
600 missing = ", ".join(missing_backends)
601 if os.getenv("TRANSFORMERS_IS_CI", "").upper() in ENV_VARS_TRUE_VALUES:
602 raise Exception(
603 "Full repo consistency checks require all backends to be installed (with `pip install -e '.[dev]'` in the "
604 f"Transformers repo, the following are missing: {missing}."
605 )
606 else:
607 warnings.warn(
608 "Full repo consistency checks require all backends to be installed (with `pip install -e '.[dev]'` in the "
609 f"Transformers repo, the following are missing: {missing}. While it's probably fine as long as you "
610 "didn't make any change in one of those backends modeling files, you should probably execute the "
611 "command above to be on the safe side."
612 )
613
614
615def check_model_list():

Calls 3

is_torch_availableFunction · 0.90
joinMethod · 0.80
warnMethod · 0.80

Tested by

no test coverage detected