Skip to content

Commit f7b6047

Browse files
tlrmchlsmthArthurZucker
authored andcommitted
Restore is_torch_greater_or_equal_than for backward compatibility (#35734)
* Restore is_torch_greater_or_equal_than for backward compatibility Signed-off-by: Tyler Michael Smith <[email protected]> * review comments Signed-off-by: Tyler Michael Smith <[email protected]> --------- Signed-off-by: Tyler Michael Smith <[email protected]>
1 parent 2e752ea commit f7b6047

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/transformers/pytorch_utils.py

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
is_torch_greater_or_equal_than_2_2 = parsed_torch_version_base >= version.parse("2.2")
3636
is_torch_greater_or_equal_than_2_1 = parsed_torch_version_base >= version.parse("2.1")
3737

38+
# For backwards compatibility (e.g. some remote codes on Hub using those variables).
39+
is_torch_greater_or_equal_than_2_0 = parsed_torch_version_base >= version.parse("2.0")
40+
is_torch_greater_or_equal_than_1_13 = parsed_torch_version_base >= version.parse("1.13")
41+
is_torch_greater_or_equal_than_1_12 = parsed_torch_version_base >= version.parse("1.12")
42+
3843
# Cache this result has it's a C FFI call which can be pretty time-consuming
3944
_torch_distributed_available = torch.distributed.is_available()
4045

0 commit comments

Comments
 (0)