[Model] Support OmniGen2 (#513)

Signed-off-by: Yupu <feng.yu.pu0330@gmail.com>
This commit is contained in:
Yupu authored and GitHub committed 2026-02-26 10:34:28 +00:00
1 parent 3eb3aa54ad
commit c9786c5c0c
6 files changed
+2536

No files matched your search

+1
View File
@@ -36,6 +36,7 @@ th {
|`StableDiffusion3Pipeline` | Stable-Diffusion-3 | `stabilityai/stable-diffusion-3.5-medium` |
|`Flux2KleinPipeline` | FLUX.2-klein | `black-forest-labs/FLUX.2-klein-4B`, `black-forest-labs/FLUX.2-klein-9B` |
|`FluxPipeline` | FLUX.1-dev | `black-forest-labs/FLUX.1-dev` |
|`OmniGen2Pipeline` | OmniGen2 | `OmniGen2/OmniGen2` |
|`StableAudioPipeline` | Stable-Audio-Open | `stabilityai/stable-audio-open-1.0` |
|`Qwen3TTSForConditionalGeneration` | Qwen3-TTS-12Hz-1.7B-CustomVoice | `Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice` |
|`Qwen3TTSForConditionalGeneration` | Qwen3-TTS-12Hz-1.7B-VoiceDesign | `Qwen/Qwen3-TTS-12Hz-1.7B-VoiceDesign` |
@@ -2,6 +2,23 @@
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
Example script for image editing with OmniGen2.
python image_edit.py \
--image input.png \
--model "OmniGen2/OmniGen2" \
--prompt "Change the background to classroom." \
--negative-prompt "(((deformed))), blurry, over saturation, bad anatomy, disfigured, poorly drawn face, mutation, mutated, (extra_limb), (ugly), (poorly drawn hands), fused fingers, messy drawing, broken legs censor, censored, censor_bar" \
--num-inference-steps 50 \
--seed 0 \
--guidance-scale 5.0 \
--guidance-scale-2 2.0 \
--output outputs/image_edit.png \
--num-outputs-per-prompt 2
Note: For OmniGen2, `guidance_scale` works as `text_guidance_scale`,
and `guidance_scale_2` works as `image_guidance_scale`.
Example script for image editing with Qwen-Image-Edit.
Usage (single image):
@@ -141,6 +158,9 @@ def parse_args() -> argparse.Namespace:
"directly as an input parameter. Enabled when guidance_scale > 1. Ignored when not using guidance-distilled models."
),
)
parser.add_argument(
"--guidance-scale-2", type=float, default=None, help="image guidance scale for image-to-image generation."
)
parser.add_argument(
"--output",
type=str,
@@ -403,6 +423,7 @@ def main():
generator=generator,
true_cfg_scale=args.cfg_scale,
guidance_scale=args.guidance_scale,
guidance_scale_2=args.guidance_scale_2,
num_inference_steps=args.num_inference_steps,
num_outputs_per_prompt=args.num_outputs_per_prompt,
layers=args.layers,
Whitespace-only changes.
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+7
View File
@@ -105,6 +105,11 @@ _DIFFUSION_MODELS = {
"pipeline_flux",
"FluxPipeline",
),
"OmniGen2Pipeline": (
"omnigen2",
"pipeline_omnigen2",
"OmniGen2Pipeline",
),
}
@@ -289,6 +294,7 @@ _DIFFUSION_POST_PROCESS_FUNCS = {
"Flux2KleinPipeline": "get_flux2_klein_post_process_func",
"NextStep11Pipeline": "get_nextstep11_post_process_func",
"FluxPipeline": "get_flux_post_process_func",
"OmniGen2Pipeline": "get_omnigen2_post_process_func",
}
_DIFFUSION_PRE_PROCESS_FUNCS = {
@@ -302,6 +308,7 @@ _DIFFUSION_PRE_PROCESS_FUNCS = {
"QwenImageLayeredPipeline": "get_qwen_image_layered_pre_process_func",
"WanPipeline": "get_wan22_pre_process_func",
"WanImageToVideoPipeline": "get_wan22_i2v_pre_process_func",
"OmniGen2Pipeline": "get_omnigen2_pre_process_func",
}