mirror of
https://github.com/vladmandic/automatic
synced 2026-09-08 05:48:42 +02:00
Initial Olive implementation.
This commit is contained in:
@@ -7,6 +7,7 @@ import torch
|
||||
import torchvision.transforms.functional as TF
|
||||
import diffusers
|
||||
from modules import shared, devices, processing, sd_samplers, sd_models, images, errors, masking, prompt_parser_diffusers, sd_hijack_hypertile, processing_correction, processing_vae
|
||||
from modules.olive import OlivePipeline
|
||||
|
||||
|
||||
debug = shared.log.trace if os.environ.get('SD_DIFFUSERS_DEBUG', None) is not None else lambda *args, **kwargs: None
|
||||
@@ -20,6 +21,9 @@ def process_diffusers(p: processing.StableDiffusionProcessing):
|
||||
orig_pipeline = shared.sd_model
|
||||
results = []
|
||||
|
||||
if isinstance(shared.sd_model, OlivePipeline):
|
||||
shared.sd_model = shared.sd_model.optimize(p.width, p.height)
|
||||
|
||||
def is_txt2img():
|
||||
return sd_models.get_diffusers_task(shared.sd_model) == sd_models.DiffusersTaskType.TEXT_2_IMAGE
|
||||
|
||||
@@ -219,7 +223,7 @@ def process_diffusers(p: processing.StableDiffusionProcessing):
|
||||
generator = [torch.Generator(generator_device).manual_seed(s) for s in p.seeds]
|
||||
prompts, negative_prompts, prompts_2, negative_prompts_2 = fix_prompts(prompts, negative_prompts, prompts_2, negative_prompts_2)
|
||||
parser = 'Fixed attention'
|
||||
if shared.opts.prompt_attention != 'Fixed attention' and 'StableDiffusion' in model.__class__.__name__:
|
||||
if shared.opts.prompt_attention != 'Fixed attention' and 'StableDiffusion' in model.__class__.__name__ and not isinstance(model, diffusers.OnnxStableDiffusionPipeline):
|
||||
try:
|
||||
prompt_parser_diffusers.encode_prompts(model, p, prompts, negative_prompts, kwargs.get("num_inference_steps", 1), kwargs.pop("clip_skip", None))
|
||||
parser = shared.opts.prompt_attention
|
||||
|
||||
Reference in New Issue
Block a user