Skip to content

[Feature] Cache or reuse prompt embeddings across generate_image calls #1774

Description

@mayocream

FLUX.2 Klein recomputes Qwen3 conditioning on every generate_image call, even when the prompt is unchanged. The current C API only accepts prompt strings, so bindings cannot cache and reuse c_crossattn/prompt embeddings.

Would you consider either:

  • a bounded per-context cache keyed by prompt and active LoRAs, or
  • an opaque encode/free condition API that generate_image can consume?

The cache should cover only text conditioning before request-specific c_concat/reference latents are attached. This would help repeated inpainting/edit calls using the same prompt with different images. Diffusers supports this through precomputed prompt_embeds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions