Skip to content

Commit bc3b58a

Browse files
gchalumpspcyppt
authored andcommitted
Fix PyTorch version compatibility check in _load_library
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"`.
1 parent 725835e commit bc3b58a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fbgemm_gpu/fbgemm_gpu/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def _load_library(filename: str, version: str, no_throw: bool = False) -> None:
8181
"""
8282
)
8383

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

0 commit comments

Comments
 (0)