(sd_model, p: processing.StableDiffusionProcessing)
| 528 | |
| 529 | |
| 530 | def 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 | |
| 552 | def validate_pipeline(p: processing.StableDiffusionProcessing): |
no test coverage detected