Skip to content

Commit 6c470d8

Browse files
authored
potential fix to pre-load DLL dir for torch-mlir (huggingface#848)
Doesn't regress the main.py script but system already pre-loaded the DLL so needs more testing.
1 parent 30b29ce commit 6c470d8

File tree

1 file changed

+5
-0
lines changed
  • shark/examples/shark_inference/stable_diffusion

1 file changed

+5
-0
lines changed

shark/examples/shark_inference/stable_diffusion/main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import os
2+
import sysconfig
23

34
os.environ["AMD_ENABLE_LLPC"] = "1"
5+
# Preload DLL paths for torch-mlir
6+
os.add_dll_directory(
7+
os.path.join(sysconfig.get_paths()["purelib"], "torch_mlir/_mlir_libs")
8+
)
49

510
from transformers import CLIPTextModel, CLIPTokenizer
611
import torch

0 commit comments

Comments
 (0)