Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ import torch
|
|
| 7 |
from huggingface_hub import snapshot_download
|
| 8 |
import openvino.runtime as ov
|
| 9 |
from typing import Optional, Dict
|
| 10 |
-
from diffusers import EulerAncestralDiscreteScheduler
|
| 11 |
|
| 12 |
#LCMScheduler 產生垃圾
|
| 13 |
#EulerDiscreteScheduler 尚可
|
|
@@ -15,6 +15,7 @@ from diffusers import EulerAncestralDiscreteScheduler
|
|
| 15 |
|
| 16 |
|
| 17 |
model_id = "hsuwill000/anything-v5-openvino"
|
|
|
|
| 18 |
|
| 19 |
#1024*512 記憶體不足
|
| 20 |
HIGH=512
|
|
@@ -34,8 +35,11 @@ pipe = OVStableDiffusionPipeline.from_pretrained(
|
|
| 34 |
use_safetensors=False,
|
| 35 |
)
|
| 36 |
print(pipe.scheduler.compatibles)
|
| 37 |
-
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
|
|
|
| 38 |
|
|
|
|
|
|
|
| 39 |
|
| 40 |
|
| 41 |
pipe.reshape( batch_size=-1, height=HIGH, width=WIDTH, num_images_per_prompt=1)
|
|
|
|
| 7 |
from huggingface_hub import snapshot_download
|
| 8 |
import openvino.runtime as ov
|
| 9 |
from typing import Optional, Dict
|
| 10 |
+
from diffusers import EulerAncestralDiscreteScheduler, LCMScheduler
|
| 11 |
|
| 12 |
#LCMScheduler 產生垃圾
|
| 13 |
#EulerDiscreteScheduler 尚可
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
model_id = "hsuwill000/anything-v5-openvino"
|
| 18 |
+
adapter_id = "latent-consistency/lcm-lora-sdv1-5"
|
| 19 |
|
| 20 |
#1024*512 記憶體不足
|
| 21 |
HIGH=512
|
|
|
|
| 35 |
use_safetensors=False,
|
| 36 |
)
|
| 37 |
print(pipe.scheduler.compatibles)
|
| 38 |
+
#pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
| 39 |
+
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
|
| 40 |
|
| 41 |
+
pipe.load_lora_weights(adapter_id)
|
| 42 |
+
pipe.fuse_lora()
|
| 43 |
|
| 44 |
|
| 45 |
pipe.reshape( batch_size=-1, height=HIGH, width=WIDTH, num_images_per_prompt=1)
|