Skip to content

SDXL-Lightning inference steps ignored #107

@stronk-dev

Description

@stronk-dev

Premise: this is a model which does not accept the guidance_scale param and loads a specific set of model weights according to the amount of num_inference_steps you want to do (1, 2, 4 or 8 steps).

As apps would request the ByteDance/SDXL-Lightning model, the following code would make it default to 2 steps:

https://github.com/livepeer/ai-worker/blob/0a26654cccca8501bddf4e026d18cfee6c9891b2/runner/app/pipelines/text_to_image.py#L57-L71

And then when running inference, it would override num_inference_steps to 2:

https://github.com/livepeer/ai-worker/blob/0a26654cccca8501bddf4e026d18cfee6c9891b2/runner/app/pipelines/text_to_image.py#L188-L201

Apparently apps needs to append 4step or 8step to the model ID if they want to do a different amount of num_inference_steps. This can be very confusing to app developers, who likely just request ByteDance/SDXL-Lightning with a specific number of num_inference_steps, which then quietly get overwritten during inference.

This would also explain why people have reported this model to have bad output, as running this model at 8 steps provides a vastly different output than at 2 steps.

Proposed solutions could be to switch unet/LoRas during inference or to make the documentation very clear how this specifc model behaves. Luckily with models like RealVisXL_V4.0_Lightning you're not tied to a specific amount of inference_steps

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