Commit f4034d4c authored by Your Name's avatar Your Name

fix: set GGML_VULKAN_DEVICE before importing stable_diffusion_cpp

parent 0f102700
...@@ -4755,6 +4755,10 @@ def main(): ...@@ -4755,6 +4755,10 @@ def main():
print(f"llama.cpp load error: {llama_error}") print(f"llama.cpp load error: {llama_error}")
print(f"Trying stable-diffusion-cpp-python fallback...") print(f"Trying stable-diffusion-cpp-python fallback...")
# Try stable-diffusion-cpp-python as fallback # Try stable-diffusion-cpp-python as fallback
# Set Vulkan device BEFORE importing stable_diffusion_cpp
if args.image_vulkan_device is not None:
os.environ['GGML_VULKAN_DEVICE'] = str(args.image_vulkan_device)
print(f"Setting GGML_VULKAN_DEVICE={args.image_vulkan_device} for image model")
try: try:
from stable_diffusion_cpp import StableDiffusion from stable_diffusion_cpp import StableDiffusion
...@@ -4819,11 +4823,6 @@ def main(): ...@@ -4819,11 +4823,6 @@ def main():
# Build kwargs based on available files # Build kwargs based on available files
sd_kwargs = {'diffusion_model_path': model_path} sd_kwargs = {'diffusion_model_path': model_path}
# Set Vulkan device for image models via GGML_VULKAN_DEVICE environment variable
if args.image_vulkan_device is not None:
os.environ['GGML_VULKAN_DEVICE'] = str(args.image_vulkan_device)
print(f"Setting GGML_VULKAN_DEVICE={args.image_vulkan_device} for image model")
if clip_l_path: if clip_l_path:
sd_kwargs['llm_path'] = clip_l_path sd_kwargs['llm_path'] = clip_l_path
print(f"DEBUG: Adding llm_path to sd_kwargs: {clip_l_path}") print(f"DEBUG: Adding llm_path to sd_kwargs: {clip_l_path}")
...@@ -5261,6 +5260,10 @@ def main(): ...@@ -5261,6 +5260,10 @@ def main():
print(f"llama.cpp load error: {llama_error}") print(f"llama.cpp load error: {llama_error}")
print(f"Trying stable-diffusion-cpp-python fallback...") print(f"Trying stable-diffusion-cpp-python fallback...")
# Try stable-diffusion-cpp-python as fallback # Try stable-diffusion-cpp-python as fallback
# Set Vulkan device BEFORE importing stable_diffusion_cpp
if args.image_vulkan_device is not None:
os.environ['GGML_VULKAN_DEVICE'] = str(args.image_vulkan_device)
print(f"Setting GGML_VULKAN_DEVICE={args.image_vulkan_device} for image model")
try: try:
from stable_diffusion_cpp import StableDiffusion from stable_diffusion_cpp import StableDiffusion
...@@ -5325,11 +5328,6 @@ def main(): ...@@ -5325,11 +5328,6 @@ def main():
# Build kwargs based on available files # Build kwargs based on available files
sd_kwargs = {'diffusion_model_path': model_path} sd_kwargs = {'diffusion_model_path': model_path}
# Set Vulkan device for image models via GGML_VULKAN_DEVICE environment variable
if args.image_vulkan_device is not None:
os.environ['GGML_VULKAN_DEVICE'] = str(args.image_vulkan_device)
print(f"Setting GGML_VULKAN_DEVICE={args.image_vulkan_device} for image model")
if clip_l_path: if clip_l_path:
sd_kwargs['llm_path'] = clip_l_path sd_kwargs['llm_path'] = clip_l_path
print(f"DEBUG: Adding llm_path to sd_kwargs: {clip_l_path}") print(f"DEBUG: Adding llm_path to sd_kwargs: {clip_l_path}")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment