vllm_omni.diffusion.models.bagel.pipeline_bagel ¶
BagelPipeline implementation for vLLM-Omni.
BagelGenParams dataclass ¶
BagelPipeline ¶
Bases: Module, SupportsComponentDiscovery, DiffusionPipelineProfilerMixin
Bagel generation pipeline (MoT) packaged for vllm-omni diffusion engine.
This pipeline is self-contained and uses the ported Bagel core files.
bagel instance-attribute ¶
bagel = Bagel(
language_model=self.language_model,
vit_model=self.vit_model,
parallel_config=parallel_config,
quant_config=quant_config,
prefix="bagel",
config=BagelConfig(
llm_config=llm_config,
vae_config=vae_cfg,
vit_config=vit_cfg,
vit_max_num_patch_per_side=int(
bagel_cfg.get("vit_max_num_patch_per_side", 70)
),
connector_act=str(
bagel_cfg.get(
"connector_act", "gelu_pytorch_tanh"
)
),
interpolate_pos=bool(
bagel_cfg.get("interpolate_pos", False)
),
latent_patch_size=int(
bagel_cfg.get("latent_patch_size", 2)
),
max_latent_size=int(
bagel_cfg.get("max_latent_size", 32)
),
timestep_shift=float(
bagel_cfg.get("timestep_shift", 1.0)
),
),
)
image_processor instance-attribute ¶
language_model instance-attribute ¶
language_model = Qwen2MoTForCausalLM(
llm_config,
parallel_config=parallel_config,
quant_config=quant_config,
prefix="bagel.language_model",
)
tokenizer instance-attribute ¶
tokenizer = AutoTokenizer.from_pretrained(
model_path,
local_files_only=True,
trust_remote_code=True,
)
weights_sources instance-attribute ¶
weights_sources = [
DiffusersPipelineLoader.ComponentSource(
model_or_path=od_config.model,
subfolder=None,
revision=od_config.revision,
prefix="",
fall_back_to_pt=False,
)
]
denoise_step ¶
denoise_step(
input_batch: InputBatch,
*,
states: Sequence[StepRequestState] | None = None,
**kwargs: object,
) -> Tensor
One denoise step: pack request-local BAGEL state and run the model.
post_decode ¶
post_decode(
state: StepRequestState, **kwargs: object
) -> DiffusionOutput
Decode final latents from state.
prepare_encode ¶
prepare_encode(
state: StepRequestState, **kwargs: object
) -> StepRequestState
Populate state with BAGEL inputs, latents, timesteps, and CFG config.
step_scheduler ¶
step_scheduler(
state: StepRequestState,
noise_pred: Tensor,
**kwargs: object,
) -> None
One scheduler step: update state.latents and advance step_index.
SiglipNaViTWrapper ¶
get_bagel_pre_process_func ¶
get_bagel_pre_process_func(od_config: OmniDiffusionConfig)
Resolve BAGEL execution mode and step-batch compatibility.