Skip to content

Commit f7a3613

Browse files
gchalumpfacebook-github-bot
authored andcommitted
PyTorch version compatibility check in _load_library (#5041)
Summary: X-link: facebookresearch/FBGEMM#2050 The version compatibility check in `_load_library` incorrectly uses exact string equality when comparing PyTorch versions, causing false incompatibility warnings. PyTorch versions typically include build metadata like `"2.8.0+cu118"` or `"2.8.1+cpu"`, while the compatibility table contains base versions like `"2.8"`. Differential Revision: D85167315
1 parent 06285d6 commit f7a3613

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fbgemm_gpu/fbgemm_gpu/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# Based on the FBGEMM-PyTorch compatibility table at
1616
# https://docs.pytorch.org/FBGEMM/general/Releases.html#fbgemm-releases-compatibility
1717
_fbgemm_torch_compat_table = {
18+
"1.4": "2.9",
1819
"1.3": "2.8",
1920
"1.2": "2.7",
2021
"1.1": "2.6",
@@ -80,7 +81,7 @@ def _load_library(filename: str, version: str, no_throw: bool = False) -> None:
8081
"""
8182
)
8283

83-
elif str(torch.__version__) != _fbgemm_torch_compat_table[keys[0]]:
84+
elif not str(torch.__version__).startswith(_fbgemm_torch_compat_table[keys[0]]):
8485
logging.warning(
8586
f"""
8687
\033[31m

0 commit comments

Comments
 (0)