Skip to content

StateManager, Hook, State: missing context setting (cond or uncond) in pipelines #12760

@toilaluan

Description

@toilaluan

In diffusion denoising model, we usually use classifier free guidance to control qualities. With State Manager, we want each context hold different state, so we have to set which context when calling self.transformer, here is a good example

But some popular pipelines (Flux2) or pipeline variants (Kontext, Image to image, Inpainting) don't implement this. For example, Flux T2I has it while Flux Kontext is missing

A Fix should be simple but require us to check all pipelines

with self.transformer.cache_context("cond"):
    noise_pred = self.transformer(...)
with self.transformer.cache_context("uncond"):
    neg_noise_pred = self.transformer(...)

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