Skip to content

Commit

Permalink
Add an option to respect LLPC env var (huggingface#875)
Browse files Browse the repository at this point in the history
Also add OSX paths
  • Loading branch information
powderluv authored Jan 25, 2023
1 parent c3a641f commit 9bbffa5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 6 additions & 2 deletions shark/examples/shark_inference/stable_diffusion/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import os
import sys

if "AMD_ENABLE_LLPC" not in os.environ:
os.environ["AMD_ENABLE_LLPC"] = "1"

os.environ["AMD_ENABLE_LLPC"] = "1"
if sys.platform == "darwin":
os.environ["DYLD_LIBRARY_PATH"] = "/usr/local/lib"

from transformers import CLIPTextModel, CLIPTokenizer
import torch
Expand Down Expand Up @@ -48,7 +53,6 @@
SharkEulerDiscreteScheduler,
)
import time
import sys
from shark.iree_utils.compile_utils import dump_isas

# Helper function to profile the vulkan device.
Expand Down
8 changes: 7 additions & 1 deletion web/index.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import os
import sys
from pathlib import Path

os.environ["AMD_ENABLE_LLPC"] = "1"
if "AMD_ENABLE_LLPC" not in os.environ:
os.environ["AMD_ENABLE_LLPC"] = "1"

if sys.platform == "darwin":
os.environ["DYLD_LIBRARY_PATH"] = "/usr/local/lib"

import gradio as gr
from PIL import Image
from models.stable_diffusion.resources import resource_path, prompt_examples
Expand Down

0 comments on commit 9bbffa5

Please sign in to comment.