MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / is_torch_version

Function is_torch_version

diffusers/src/diffusers/utils/import_utils.py:690–700  ·  view source on GitHub ↗

Compares the current PyTorch version to a given reference with an operation. Args: operation (`str`): A string representation of an operator, such as `">"` or `"<="` version (`str`): A string version of PyTorch

(operation: str, version: str)

Source from the content-addressed store, hash-verified

688
689# This function was copied from: https://github.com/huggingface/accelerate/blob/874c4967d94badd24f893064cc3bef45f57cadf7/src/accelerate/utils/versions.py#L338
690def is_torch_version(operation: str, version: str):
691 """
692 Compares the current PyTorch version to a given reference with an operation.
693
694 Args:
695 operation (`str`):
696 A string representation of an operator, such as `">"` or `"<="`
697 version (`str`):
698 A string version of PyTorch
699 """
700 return compare_versions(parse(_torch_version), operation, version)
701
702
703def is_transformers_version(operation: str, version: str):

Callers 15

is_compiled_moduleFunction · 0.85
__init_subclass__Method · 0.85
require_torch_2Function · 0.85
decoratorFunction · 0.85
from_pretrainedMethod · 0.85
__call__Method · 0.85
__call__Method · 0.85
__call__Method · 0.85
__call__Method · 0.85
forwardMethod · 0.85
forwardMethod · 0.85
forwardMethod · 0.85

Calls 1

compare_versionsFunction · 0.85

Tested by 2

require_torch_2Function · 0.68
decoratorFunction · 0.68