add optimization to openjourney (#12423)

* add optimization to openjourney

* add optimization to openjourney
This commit is contained in:
Jinhe 2024-11-21 15:23:51 +08:00 committed by GitHub
parent 145e8b480f
commit 7e0a840f74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View file

@ -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
```

View file

@ -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():