From 7e0a840f74732f4dfd681d58fe4c1a86f2f08883 Mon Sep 17 00:00:00 2001 From: Jinhe Date: Thu, 21 Nov 2024 15:23:51 +0800 Subject: [PATCH] add optimization to openjourney (#12423) * add optimization to openjourney * add optimization to openjourney --- .../GPU/HuggingFace/Multimodal/StableDiffusion/README.md | 2 +- .../GPU/HuggingFace/Multimodal/StableDiffusion/openjourney.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/python/llm/example/GPU/HuggingFace/Multimodal/StableDiffusion/README.md b/python/llm/example/GPU/HuggingFace/Multimodal/StableDiffusion/README.md index 631f2b8b..3d39402d 100644 --- a/python/llm/example/GPU/HuggingFace/Multimodal/StableDiffusion/README.md +++ b/python/llm/example/GPU/HuggingFace/Multimodal/StableDiffusion/README.md @@ -9,7 +9,7 @@ Follow the instructions in IPEX-GPU installation guides ([Linux Guide](https://i Assume you have created a conda environment named diffusion with ipex-llm installed. Run below commands to install dependencies for running Stable Diffusion. ```bash conda activate diffusion -pip install diffusers["torch"] transformers +pip install diffusers["torch"]==0.31.0 transformers pip install -U PEFT transformers ``` diff --git a/python/llm/example/GPU/HuggingFace/Multimodal/StableDiffusion/openjourney.py b/python/llm/example/GPU/HuggingFace/Multimodal/StableDiffusion/openjourney.py index b8730c4c..f7c2101d 100644 --- a/python/llm/example/GPU/HuggingFace/Multimodal/StableDiffusion/openjourney.py +++ b/python/llm/example/GPU/HuggingFace/Multimodal/StableDiffusion/openjourney.py @@ -17,7 +17,7 @@ from diffusers import StableDiffusionPipeline import torch -import ipex_llm +from ipex_llm import optimize_model import argparse import time @@ -27,6 +27,7 @@ def main(args): args.repo_id_or_model_path, torch_dtype=torch.float16, use_safetensors=True) + pipe = optimize_model(pipe, low_bit=None) pipe = pipe.to("xpu") with torch.inference_mode():