MCPcopy Index your code
hub / github.com/vladmandic/sdnext / update_pipeline

Function update_pipeline

modules/processing_diffusers.py:530–549  ·  view source on GitHub ↗
(sd_model, p: processing.StableDiffusionProcessing)

Source from the content-addressed store, hash-verified

528
529
530def update_pipeline(sd_model, p: processing.StableDiffusionProcessing):
531 if sd_model is None:
532 sd_model = shared.sd_model
533 if sd_model is None:
534 log.warning('Processing: op=update model not loaded')
535 return None
536 updated_model = sd_model
537 if sd_models.get_diffusers_task(sd_model) == sd_models.DiffusersTaskType.INPAINTING and getattr(p, 'image_mask', None) is None and p.task_args.get('image_mask', None) is None and getattr(p, 'mask', None) is None:
538 log.warning('Processing: mode=inpaint mask=None')
539 updated_model = sd_models.set_diffuser_pipe(sd_model, sd_models.DiffusersTaskType.IMAGE_2_IMAGE)
540 if shared.opts.cuda_compile_backend == "olive-ai":
541 updated_model = olive_check_parameters_changed(p, is_refiner_enabled(p))
542 if sd_model.__class__.__name__ == "OnnxRawPipeline":
543 updated_model = preprocess_onnx_pipeline(p)
544 global orig_pipeline # pylint: disable=global-statement
545 orig_pipeline = updated_model # processed ONNX pipeline should not be replaced with original pipeline.
546 if getattr(updated_model, "current_attn_name", None) != shared.opts.cross_attention_optimization:
547 log.info(f"Setting attention optimization: {shared.opts.cross_attention_optimization}")
548 attention.set_diffusers_attention(updated_model)
549 return updated_model
550
551
552def validate_pipeline(p: processing.StableDiffusionProcessing):

Callers 1

process_baseFunction · 0.85

Calls 3

is_refiner_enabledFunction · 0.90
infoMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected