Skip to content

PipelineProgress.currentLatent is never populated, so consumers cannot show a live preview #231

Description

@james-333i

What are you trying to build?

PipelineProgress has carried a currentLatent field since it was introduced, but Flux2Pipeline, SD3Pipeline and StableDiffusionPipeline all pass nil. Apps that want to show the image forming during generation have nothing to render.

Proposed change for FLUX.2, on my fork: main...james-333i:coreai-models:flux-preview-latents

After each Euler step it computes the flow-matching x0 prediction (x0 = x_t minus sigma times v), converts it to VAE latent space (unpack, batch-norm denorm, unpatchify) and hands it to the progress handler as a [1, 32, H/8, W/8] array. The final step is skipped since the decoded image follows immediately. The cost is a few array copies per step, negligible next to a transformer pass.

On the consumer side a cheap channel-to-RGB projection is enough for a recognizable preview. I fitted a 32x3 linear map against the FLUX.2 VAE by encoding a set of images and regressing against their downscaled RGB, and the previews show subject, color and composition clearly at every step. I can include those factors in a follow-up if a preview helper is wanted in the package itself. Glad to send this as a PR if PR creation opens up.

Where are the current docs or utilities unclear?

N/A

Expected improvement

Allows consumer to see progress on image generation steps.

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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