Skip to content

Commit ec79f86

Browse files
author
liyuzhuo
committed
[fix] fix import error cased by _load_cuda_libs when running pytest
1 parent 12b2077 commit ec79f86

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • transformer_engine/plugin/core/backends/vendor/cuda

transformer_engine/plugin/core/backends/vendor/cuda/cuda.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ def try_load_lib(name, search_patterns):
6565
try_load_lib("nvrtc", [f"libnvrtc{ext}*"])
6666
try_load_lib("curand", [f"libcurand{ext}*"])
6767

68-
te_path = Path(importlib.util.find_spec("transformer_engine").origin).parent.parent
68+
te_path_override = os.environ.get("TE_LIB_PATH")
69+
if te_path_override:
70+
te_path = Path(te_path_override)
71+
else:
72+
te_path = Path(importlib.util.find_spec("transformer_engine").origin).parent.parent
6973
for search_dir in [te_path, te_path / "transformer_engine"]:
7074
if search_dir.exists():
7175
matches = list(search_dir.glob(f"libtransformer_engine{ext}*"))

0 commit comments

Comments
 (0)