txt2img_flux2

Generate an image with FLUX.2 klein

Description

Step-distilled text-to-image (klein-4B: 4 steps, no guidance): Qwen3 prompt encoding (chat template, mid-stack hidden states), FlowMatch denoising with the empirical dynamic shift, and 32-channel VAE decode through the BatchNorm latent statistics.

Usage

txt2img_flux2(prompt, pipeline = NULL, width = 1024L, height = 1024L,
              num_inference_steps = 4L, max_sequence_length = 512L,
              seed = NULL, prompt_embeds = NULL, save_file = TRUE,
              filename = NULL, verbose = TRUE, ...)

Arguments

  • prompt: Character. The prompt.
  • pipeline: A flux2_pipeline from flux2_load_pipeline; NULL loads one (passing ... through).
  • num_inference_steps: Integer. Denoising steps (klein-4B: 4).
  • max_sequence_length: Integer. Qwen3 token length (512).
  • seed: Integer or NULL. Latents are drawn on the CPU in the packed shape, so a seed matches a Python diffusers run with a CPU generator.
  • prompt_embeds: Optional precomputed [B, S, 7680] embeddings.
  • save_file: Logical. Write a PNG.
  • filename: Output path (default derived from the prompt).
  • verbose: Logical.
  • ...: Passed to flux2_load_pipeline when pipeline is NULL.
  • width,height: Integers, divisible by 16.

Value

Invisibly, list(image, metadata) where image is an [H, W, 3] array in [0, 1].