vllm_omni.diffusion.models.flux.pipeline_flux_kontext ¶
FluxKontextPipeline ¶
Bases: Module, FluxPipelineMixin, SupportImageInput, ProgressBarMixin, DiffusionPipelineProfilerMixin
FLUX.1-Kontext pipeline for image editing with text guidance.
image_processor instance-attribute ¶
latent_channels instance-attribute ¶
latent_channels = (
latent_channels if hasattr(vae, "config") else 16
)
scheduler instance-attribute ¶
tokenizer instance-attribute ¶
tokenizer_2 instance-attribute ¶
tokenizer_max_length instance-attribute ¶
tokenizer_max_length = (
model_max_length
if hasattr(self, "tokenizer") and tokenizer is not None
else 77
)
transformer instance-attribute ¶
transformer = FluxKontextTransformer2DModel(
**transformer_kwargs
)
vae_scale_factor instance-attribute ¶
weights_sources instance-attribute ¶
weights_sources = [
ComponentSource(
model_or_path=model,
subfolder="transformer",
revision=None,
prefix="transformer.",
fall_back_to_pt=True,
)
]
check_inputs ¶
check_inputs(
prompt,
prompt_2=None,
height=None,
width=None,
negative_prompt=None,
negative_prompt_2=None,
prompt_embeds=None,
pooled_prompt_embeds=None,
negative_prompt_embeds=None,
negative_pooled_prompt_embeds=None,
callback_on_step_end_tensor_inputs=None,
max_sequence_length=None,
)
encode_prompt ¶
encode_prompt(
prompt: str | list[str],
prompt_2: str | list[str] | None = None,
device: device | None = None,
num_images_per_prompt: int = 1,
prompt_embeds: FloatTensor | None = None,
pooled_prompt_embeds: FloatTensor | None = None,
max_sequence_length: int = 512,
)
forward ¶
forward(
req: OmniDiffusionRequest,
image: Image | list[Image] | None = None,
prompt: str | list[str] | None = None,
prompt_2: str | list[str] | None = None,
negative_prompt: str | list[str] | None = None,
negative_prompt_2: str | list[str] | None = None,
height: int | None = None,
width: int | None = None,
num_inference_steps: int = 28,
guidance_scale: float = 3.5,
true_cfg_scale: float = 1.0,
num_images_per_prompt: int = 1,
generator: Generator | list[Generator] | None = None,
latents: Tensor | None = None,
prompt_embeds: Tensor | None = None,
pooled_prompt_embeds: Tensor | None = None,
negative_prompt_embeds: Tensor | None = None,
negative_pooled_prompt_embeds: Tensor | None = None,
output_type: str | None = "pil",
return_dict: bool = True,
attention_kwargs: dict[str, Any] | None = None,
callback_on_step_end: Callable[[int, int, dict], None]
| None = None,
callback_on_step_end_tensor_inputs: list[str] = [
"latents"
],
max_sequence_length: int = 512,
sigmas: list[float] | None = None,
) -> DiffusionOutput
get_flux_kontext_post_process_func ¶
get_flux_kontext_post_process_func(
od_config: OmniDiffusionConfig,
) -> Callable
Get postprocessing function for FLUX.1-Kontext pipeline.