Skip to content

Commit 9bbffa5

Browse files
authored
Add an option to respect LLPC env var (huggingface#875)
Also add OSX paths
1 parent c3a641f commit 9bbffa5

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

shark/examples/shark_inference/stable_diffusion/main.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import os
2+
import sys
3+
4+
if "AMD_ENABLE_LLPC" not in os.environ:
5+
os.environ["AMD_ENABLE_LLPC"] = "1"
26

3-
os.environ["AMD_ENABLE_LLPC"] = "1"
7+
if sys.platform == "darwin":
8+
os.environ["DYLD_LIBRARY_PATH"] = "/usr/local/lib"
49

510
from transformers import CLIPTextModel, CLIPTokenizer
611
import torch
@@ -48,7 +53,6 @@
4853
SharkEulerDiscreteScheduler,
4954
)
5055
import time
51-
import sys
5256
from shark.iree_utils.compile_utils import dump_isas
5357

5458
# Helper function to profile the vulkan device.

web/index.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import os
2+
import sys
23
from pathlib import Path
34

4-
os.environ["AMD_ENABLE_LLPC"] = "1"
5+
if "AMD_ENABLE_LLPC" not in os.environ:
6+
os.environ["AMD_ENABLE_LLPC"] = "1"
7+
8+
if sys.platform == "darwin":
9+
os.environ["DYLD_LIBRARY_PATH"] = "/usr/local/lib"
10+
511
import gradio as gr
612
from PIL import Image
713
from models.stable_diffusion.resources import resource_path, prompt_examples

0 commit comments

Comments
 (0)