add optimization to openjourney (#12423)
* add optimization to openjourney * add optimization to openjourney
This commit is contained in:
parent
145e8b480f
commit
7e0a840f74
2 changed files with 3 additions and 2 deletions
|
|
@ -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.
|
Assume you have created a conda environment named diffusion with ipex-llm installed. Run below commands to install dependencies for running Stable Diffusion.
|
||||||
```bash
|
```bash
|
||||||
conda activate diffusion
|
conda activate diffusion
|
||||||
pip install diffusers["torch"] transformers
|
pip install diffusers["torch"]==0.31.0 transformers
|
||||||
pip install -U PEFT transformers
|
pip install -U PEFT transformers
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
from diffusers import StableDiffusionPipeline
|
from diffusers import StableDiffusionPipeline
|
||||||
import torch
|
import torch
|
||||||
import ipex_llm
|
from ipex_llm import optimize_model
|
||||||
import argparse
|
import argparse
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
@ -27,6 +27,7 @@ def main(args):
|
||||||
args.repo_id_or_model_path,
|
args.repo_id_or_model_path,
|
||||||
torch_dtype=torch.float16,
|
torch_dtype=torch.float16,
|
||||||
use_safetensors=True)
|
use_safetensors=True)
|
||||||
|
pipe = optimize_model(pipe, low_bit=None)
|
||||||
pipe = pipe.to("xpu")
|
pipe = pipe.to("xpu")
|
||||||
|
|
||||||
with torch.inference_mode():
|
with torch.inference_mode():
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue