faster
Browse files
backend/lcm_text_to_image.py
CHANGED
@@ -5,6 +5,8 @@ from backend.models.lcmdiffusion_setting import LCMDiffusionSetting
|
|
5 |
import numpy as np
|
6 |
from constants import DEVICE
|
7 |
from backend.models.lcmdiffusion_setting import LCMLora
|
|
|
|
|
8 |
from backend.device import is_openvino_device
|
9 |
from backend.openvino.pipelines import (
|
10 |
get_ov_text_to_image_pipeline,
|
@@ -326,7 +328,10 @@ class LCMTextToImage:
|
|
326 |
lcm_diffusion_setting.diffusion_task
|
327 |
== DiffusionTask.image_to_image.value
|
328 |
):
|
329 |
-
|
|
|
|
|
|
|
330 |
image=lcm_diffusion_setting.init_image,
|
331 |
strength=lcm_diffusion_setting.strength,
|
332 |
prompt=lcm_diffusion_setting.prompt,
|
|
|
5 |
import numpy as np
|
6 |
from constants import DEVICE
|
7 |
from backend.models.lcmdiffusion_setting import LCMLora
|
8 |
+
from utils_sd import register_normal_pipeline, register_faster_forward, register_parallel_pipeline, seed_everything # 1.import package
|
9 |
+
|
10 |
from backend.device import is_openvino_device
|
11 |
from backend.openvino.pipelines import (
|
12 |
get_ov_text_to_image_pipeline,
|
|
|
328 |
lcm_diffusion_setting.diffusion_task
|
329 |
== DiffusionTask.image_to_image.value
|
330 |
):
|
331 |
+
register_parallel_pipeline(self.pipeline) # 2. enable parallel. If memory is limited, replace it with `register_normal_pipeline(pipe)`
|
332 |
+
register_faster_forward(self.pipeline.unet) # 3. encoder propagation
|
333 |
+
|
334 |
+
result_images = self.pipeline.call(
|
335 |
image=lcm_diffusion_setting.init_image,
|
336 |
strength=lcm_diffusion_setting.strength,
|
337 |
prompt=lcm_diffusion_setting.prompt,
|