Skip to content

[SD-XL] Enhanced inference control #4003

Closed
@bghira

Description

@bghira

Feature Request: Enhanced Control of the Inference Process in SDXL Pipeline

We are seeking to enhance the control over the denoising process within the SDXL pipeline. The objective is to better handle the generation and refinement of images through fine-tuning of noise application and control of the inference process.

Describe the solution you'd like

  1. Introduce a new parameter, max_inference_steps: This new parameter, optional, will control the number of steps in the inference process before returning the outputs. This provides an early exit option during the denoising process. For instance, if num_inference_steps=20 and max_inference_steps=10, the pipeline will output a latent that is half denoised.

  2. Introduce a new parameter, add_noise: This optional parameter, defaulting to True for backward compatibility, controls the addition of noise to the input in the SDXL Img2Img pipeline. When set to False, this parameter will prevent further noise from being added to the inputs. We need this, so that the details from the base image are not overwritten by the refiner, which does not have great composition in its data distribution.

  3. Introduce a new parameter, first_inference_step: This optional parameter, defaulting to None for backward compatibility, is intended for the SDXL Img2Img pipeline. When set, the pipeline will not use the strength parameter to reduce num_inference_steps, and early timesteps will be skipped, allowing alignment and reducing artifacts.

Describe alternatives you've considered

Using the callback function from the base pipeline to retrieve the latents halfway through, and pass them in as latents to the Refiner model is a hack approach, but it's the only other one there is.

Intended outcome

These enhancements will allow for more nuanced and precise control over the image generation and refining process within the SDXL pipeline, leading to more effective and desired results.

Kindly review and consider this proposal. I can begin this work, if it is accepted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions