[Config Refactor]: Remove bagel yaml (#2936)
Signed-off-by: princepride <wangzhipeng628@gmail.com> Signed-off-by: 汪志鹏 <wangzhipeng628@gmail.com> Co-authored-by: SYLAR <125541396+lishunyang12@users.noreply.github.com>
This commit is contained in:
1 parent
22ffb85063
commit
37e5954acf
31 files changed
+1067
-1420
No files matched your search
@@ -588,6 +588,9 @@ class OmniBagelForConditionalGeneration(BagelForConditionalGeneration):
|
||||
existing = self._ropes_metadata.get(rid)
|
||||
if existing and "image_shape" in existing and "image_shape" not in meta:
|
||||
continue
|
||||
ropes = meta.get("ropes")
|
||||
if ropes:
|
||||
meta["ropes"] = [int(r.item()) if isinstance(r, torch.Tensor) else r for r in ropes]
|
||||
self._ropes_metadata[rid] = meta
|
||||
|
||||
def _parse_and_validate_multimodal_inputs(self, **kwargs: object) -> dict:
|
||||
@@ -731,7 +734,7 @@ class OmniBagelForConditionalGeneration(BagelForConditionalGeneration):
|
||||
positions = self._adjust_positions_for_img2img(positions, input_ids)
|
||||
use_mot = True
|
||||
else:
|
||||
rope = int(positions[seq_len - 1].item()) + 1
|
||||
rope = positions[seq_len - 1] + 1
|
||||
self._ropes_pending.append({"ropes": [rope]})
|
||||
|
||||
if use_mot:
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
"""BAGEL-7B-MoT pipeline topologies (frozen).
|
||||
|
||||
Two-stage (default):
|
||||
Stage 0: Thinker — multimodal understanding + text generation (AR)
|
||||
Stage 1: DiT — diffusion image generation
|
||||
|
||||
Two-stage think:
|
||||
Same as two-stage but the Thinker decodes <think>...</think> tokens before
|
||||
KV transfer. Uses expand_cfg_prompts_think (companion max_tokens=1) and
|
||||
omits kv_transfer_criteria so transfer happens after EOS, not after prefill.
|
||||
|
||||
Single-stage:
|
||||
Stage 0: DiT — self-contained diffusion stage that handles all modalities
|
||||
(text2img, img2img, img2text, text2text, think) internally via its
|
||||
own LLM, ViT, VAE, and tokenizer.
|
||||
"""
|
||||
|
||||
from vllm_omni.config.stage_config import (
|
||||
PipelineConfig,
|
||||
StageExecutionType,
|
||||
StagePipelineConfig,
|
||||
)
|
||||
|
||||
_PROC = "vllm_omni.model_executor.stage_input_processors.bagel"
|
||||
|
||||
BAGEL_PIPELINE = PipelineConfig(
|
||||
model_type="bagel",
|
||||
model_arch="OmniBagelForConditionalGeneration",
|
||||
hf_architectures=("BagelForConditionalGeneration",),
|
||||
stages=(
|
||||
StagePipelineConfig(
|
||||
stage_id=0,
|
||||
model_stage="thinker",
|
||||
execution_type=StageExecutionType.LLM_AR,
|
||||
input_sources=(),
|
||||
final_output=True,
|
||||
final_output_type="text",
|
||||
owns_tokenizer=True,
|
||||
requires_multimodal_data=True,
|
||||
model_arch="OmniBagelForConditionalGeneration",
|
||||
engine_output_type="text",
|
||||
prompt_expand_func=f"{_PROC}.expand_cfg_prompts",
|
||||
omni_kv_config={
|
||||
"need_send_cache": True,
|
||||
"kv_transfer_criteria": {"type": "prefill_finished"},
|
||||
},
|
||||
sampling_constraints={"detokenize": True},
|
||||
),
|
||||
StagePipelineConfig(
|
||||
stage_id=1,
|
||||
model_stage="dit",
|
||||
execution_type=StageExecutionType.DIFFUSION,
|
||||
input_sources=(0,),
|
||||
final_output=True,
|
||||
final_output_type="image",
|
||||
cfg_kv_collect_func=f"{_PROC}.collect_cfg_kv_caches",
|
||||
omni_kv_config={"need_recv_cache": True},
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
BAGEL_THINK_PIPELINE = PipelineConfig(
|
||||
model_type="bagel_think",
|
||||
model_arch="OmniBagelForConditionalGeneration",
|
||||
hf_architectures=(),
|
||||
stages=(
|
||||
StagePipelineConfig(
|
||||
stage_id=0,
|
||||
model_stage="thinker",
|
||||
execution_type=StageExecutionType.LLM_AR,
|
||||
input_sources=(),
|
||||
final_output=True,
|
||||
final_output_type="text",
|
||||
owns_tokenizer=True,
|
||||
requires_multimodal_data=True,
|
||||
model_arch="OmniBagelForConditionalGeneration",
|
||||
engine_output_type="text",
|
||||
prompt_expand_func=f"{_PROC}.expand_cfg_prompts_think",
|
||||
omni_kv_config={"need_send_cache": True},
|
||||
sampling_constraints={"detokenize": True},
|
||||
),
|
||||
StagePipelineConfig(
|
||||
stage_id=1,
|
||||
model_stage="dit",
|
||||
execution_type=StageExecutionType.DIFFUSION,
|
||||
input_sources=(0,),
|
||||
final_output=True,
|
||||
final_output_type="image",
|
||||
cfg_kv_collect_func=f"{_PROC}.collect_cfg_kv_caches",
|
||||
omni_kv_config={"need_recv_cache": True},
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
BAGEL_SINGLE_STAGE_PIPELINE = PipelineConfig(
|
||||
model_type="bagel_single_stage",
|
||||
model_arch="BagelForConditionalGeneration",
|
||||
hf_architectures=(),
|
||||
stages=(
|
||||
StagePipelineConfig(
|
||||
stage_id=0,
|
||||
model_stage="dit",
|
||||
execution_type=StageExecutionType.DIFFUSION,
|
||||
input_sources=(),
|
||||
final_output=True,
|
||||
final_output_type="image",
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -1,102 +0,0 @@
|
||||
# Stage 0: Thinker (multimodal understanding + text generation)
|
||||
|
||||
# By default this config uses the shared-memory connector for stage-0 -> stage-1 forwarding.
|
||||
# To switch to RDMA, add output_connectors/input_connectors that point to
|
||||
# rdma_connector and keep the rest of the pipeline unchanged.
|
||||
|
||||
stage_args:
|
||||
- stage_id: 0
|
||||
stage_type: llm
|
||||
prompt_expand_func: vllm_omni.model_executor.stage_input_processors.bagel.expand_cfg_prompts
|
||||
runtime:
|
||||
devices: "0"
|
||||
# 3 = 1 user prompt + 2 CFG companions (text-unconditional + image-unconditional).
|
||||
engine_args:
|
||||
model_stage: thinker
|
||||
max_num_seqs: 3
|
||||
model_arch: OmniBagelForConditionalGeneration
|
||||
worker_type: ar
|
||||
scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler
|
||||
gpu_memory_utilization: 0.45
|
||||
enforce_eager: true
|
||||
trust_remote_code: true
|
||||
engine_output_type: text
|
||||
distributed_executor_backend: "mp"
|
||||
enable_prefix_caching: false
|
||||
max_num_batched_tokens: 32768
|
||||
tensor_parallel_size: 1
|
||||
omni_kv_config:
|
||||
need_send_cache: true
|
||||
kv_transfer_criteria:
|
||||
type: prefill_finished #or special token generated
|
||||
final_output: true
|
||||
final_output_type: text
|
||||
is_comprehension: true
|
||||
default_sampling_params:
|
||||
temperature: 0.4
|
||||
top_p: 0.9
|
||||
top_k: 1
|
||||
max_tokens: 2048
|
||||
seed: 52
|
||||
detokenize: True
|
||||
repetition_penalty: 1.05
|
||||
# Optional RDMA override:
|
||||
# output_connectors:
|
||||
# to_stage_1: rdma_connector
|
||||
|
||||
- stage_id: 1
|
||||
stage_type: diffusion
|
||||
cfg_kv_collect_func: vllm_omni.model_executor.stage_input_processors.bagel.collect_cfg_kv_caches
|
||||
runtime:
|
||||
devices: "0"
|
||||
engine_args:
|
||||
model_stage: dit
|
||||
max_num_seqs: 1
|
||||
enforce_eager: true
|
||||
trust_remote_code: true
|
||||
distributed_executor_backend: "mp"
|
||||
omni_kv_config:
|
||||
need_recv_cache: true
|
||||
engine_input_source: [0]
|
||||
|
||||
final_output: true
|
||||
final_output_type: image
|
||||
is_comprehension: false
|
||||
default_sampling_params:
|
||||
seed: 52
|
||||
# Optional RDMA override:
|
||||
# input_connectors:
|
||||
# from_stage_0: rdma_connector
|
||||
|
||||
# Runtime edges
|
||||
runtime:
|
||||
enabled: true
|
||||
# Distributed connectors configuration (optional)
|
||||
# More connectors will be supported in the future.
|
||||
connectors:
|
||||
shared_memory_connector:
|
||||
name: SharedMemoryConnector
|
||||
extra:
|
||||
shm_threshold_bytes: 65536 # 64KB threshold
|
||||
|
||||
# Optional RDMA connector template for Bagel. To enable it, point
|
||||
# stage-0 output_connectors/to_stage_1 and stage-1 input_connectors/from_stage_0
|
||||
# to rdma_connector instead of relying on the default shared-memory path.
|
||||
rdma_connector:
|
||||
name: MooncakeTransferEngineConnector
|
||||
extra:
|
||||
host: "auto"
|
||||
zmq_port: 50051
|
||||
protocol: "rdma"
|
||||
device_name: ""
|
||||
# Memory pool for RDMA-registered buffers.
|
||||
# Supports both CPU pinned memory ("cpu") and GPU VRAM ("cuda").
|
||||
# CPU mode works on all topologies; GPU mode (GPUDirect RDMA) requires
|
||||
# NIC-GPU direct PCIe connectivity (PIX topology).
|
||||
# Recommended: 4 GB for CPU, 2 GB for GPU (to conserve VRAM).
|
||||
memory_pool_size: 4294967296 # 4 GB
|
||||
memory_pool_device: "cpu"
|
||||
|
||||
edges:
|
||||
- from: 0
|
||||
to: 1
|
||||
@@ -1,102 +0,0 @@
|
||||
# Stage 0: Thinker (multimodal understanding + text generation)
|
||||
|
||||
stage_args:
|
||||
- stage_id: 0
|
||||
stage_type: llm
|
||||
runtime:
|
||||
devices: "0"
|
||||
engine_args:
|
||||
model_stage: thinker
|
||||
max_num_seqs: 1
|
||||
model_arch: BagelForConditionalGeneration
|
||||
worker_type: ar
|
||||
scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler
|
||||
gpu_memory_utilization: 0.45
|
||||
enforce_eager: true
|
||||
trust_remote_code: true
|
||||
engine_output_type: text
|
||||
distributed_executor_backend: "mp"
|
||||
enable_prefix_caching: false
|
||||
max_num_batched_tokens: 32768
|
||||
tensor_parallel_size: 1
|
||||
omni_kv_config:
|
||||
need_send_cache: true
|
||||
kv_transfer_criteria:
|
||||
type: prefill_finished #or special token generated
|
||||
final_output: true
|
||||
final_output_type: text
|
||||
is_comprehension: true
|
||||
default_sampling_params:
|
||||
temperature: 0.4
|
||||
top_p: 0.9
|
||||
top_k: 1
|
||||
max_tokens: 2048
|
||||
seed: 52
|
||||
detokenize: True
|
||||
repetition_penalty: 1.05
|
||||
output_connectors:
|
||||
to_stage_1: mooncake_connector
|
||||
|
||||
|
||||
- stage_id: 1
|
||||
stage_type: diffusion
|
||||
runtime:
|
||||
devices: "0"
|
||||
engine_args:
|
||||
model_stage: dit
|
||||
max_num_seqs: 1
|
||||
enforce_eager: true
|
||||
trust_remote_code: true
|
||||
distributed_executor_backend: "mp"
|
||||
omni_kv_config:
|
||||
need_recv_cache: true
|
||||
engine_input_source: [0]
|
||||
|
||||
final_output: true
|
||||
final_output_type: image
|
||||
is_comprehension: false
|
||||
default_sampling_params:
|
||||
seed: 52
|
||||
input_connectors:
|
||||
from_stage_0: mooncake_connector
|
||||
|
||||
|
||||
# Runtime edges
|
||||
runtime:
|
||||
enabled: true
|
||||
# Distributed connectors configuration (optional)
|
||||
# More connectors will be supported in the future.
|
||||
connectors:
|
||||
# Mooncake connector for cross-node/intra-node communication
|
||||
mooncake_connector:
|
||||
name: MooncakeStoreConnector
|
||||
extra:
|
||||
host: "127.0.0.1"
|
||||
metadata_server: "http://10.90.67.86:8080/metadata"
|
||||
master: "10.90.67.86:50051"
|
||||
segment: 512000000 # 512MB
|
||||
localbuf: 64000000 # 64MB
|
||||
proto: "tcp"
|
||||
|
||||
# PR1 (#1019) note:
|
||||
# - Keep this transfer-engine connector config as a ready-to-use template.
|
||||
# - Bagel does NOT consume this connector in PR1(#1019).
|
||||
# - output_connectors/input_connectors above still point to mooncake_connector.
|
||||
# - We will switch Bagel to this connector in the next PR.
|
||||
rdma_connector:
|
||||
name: MooncakeTransferEngineConnector
|
||||
extra:
|
||||
# NOTE:
|
||||
# - role/sender_host/sender_zmq_port are internal fields resolved by
|
||||
# orchestration logic and should not be set in user YAML.
|
||||
host: "auto" # Auto-detect local IP for RDMA
|
||||
zmq_port: 50051 # ZMQ base port (actual port uses runtime offsets)
|
||||
protocol: "rdma"
|
||||
device_name: "" # e.g. "mlx5_0"; empty for auto-detect
|
||||
memory_pool_size: 2147483648 # 2GB
|
||||
memory_pool_device: "cpu" # "cuda" for GPUDirect RDMA, "cpu" for pinned memory
|
||||
|
||||
|
||||
edges:
|
||||
- from: 0
|
||||
to: 1
|
||||
@@ -1,24 +0,0 @@
|
||||
# Stage 0: Thinker (multimodal understanding + text generation)
|
||||
|
||||
stage_args:
|
||||
|
||||
- stage_id: 0
|
||||
stage_type: diffusion
|
||||
runtime:
|
||||
devices: "0"
|
||||
engine_args:
|
||||
model_stage: dit
|
||||
max_num_seqs: 1
|
||||
enforce_eager: true
|
||||
trust_remote_code: true
|
||||
distributed_executor_backend: "mp"
|
||||
|
||||
final_output: true
|
||||
final_output_type: image
|
||||
is_comprehension: false
|
||||
default_sampling_params:
|
||||
seed: 52
|
||||
|
||||
# Runtime edges
|
||||
runtime:
|
||||
enabled: true
|
||||
@@ -1,77 +0,0 @@
|
||||
# BAGEL Think Model: AR stage decodes thinking tokens before KV transfer to DiT.
|
||||
#
|
||||
# Differences from bagel.yaml:
|
||||
# - No kv_transfer_criteria: AR stage decodes until EOS, then transfers full
|
||||
# KV cache (including thinking tokens) via _free_request path.
|
||||
# - prompt_expand_func: uses expand_cfg_prompts_think which sets max_tokens=1
|
||||
# on companion requests so they stop immediately after prefill.
|
||||
# - max_tokens: 2048 for thinking text generation.
|
||||
|
||||
stage_args:
|
||||
- stage_id: 0
|
||||
stage_type: llm
|
||||
prompt_expand_func: vllm_omni.model_executor.stage_input_processors.bagel.expand_cfg_prompts_think
|
||||
runtime:
|
||||
devices: "0"
|
||||
engine_args:
|
||||
model_stage: thinker
|
||||
max_num_seqs: 3
|
||||
model_arch: OmniBagelForConditionalGeneration
|
||||
worker_type: ar
|
||||
scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler
|
||||
gpu_memory_utilization: 0.45
|
||||
enforce_eager: true
|
||||
trust_remote_code: true
|
||||
engine_output_type: text
|
||||
distributed_executor_backend: "mp"
|
||||
enable_prefix_caching: false
|
||||
max_num_batched_tokens: 32768
|
||||
tensor_parallel_size: 1
|
||||
omni_kv_config:
|
||||
need_send_cache: true
|
||||
final_output: true
|
||||
final_output_type: text
|
||||
is_comprehension: true
|
||||
default_sampling_params:
|
||||
temperature: 0.3
|
||||
top_p: 0.9
|
||||
top_k: 1
|
||||
max_tokens: 2048
|
||||
seed: 52
|
||||
detokenize: True
|
||||
repetition_penalty: 1.05
|
||||
|
||||
- stage_id: 1
|
||||
stage_type: diffusion
|
||||
cfg_kv_collect_func: vllm_omni.model_executor.stage_input_processors.bagel.collect_cfg_kv_caches
|
||||
runtime:
|
||||
devices: "0"
|
||||
engine_args:
|
||||
model_stage: dit
|
||||
max_num_seqs: 1
|
||||
enforce_eager: true
|
||||
trust_remote_code: true
|
||||
distributed_executor_backend: "mp"
|
||||
omni_kv_config:
|
||||
need_recv_cache: true
|
||||
engine_input_source: [0]
|
||||
|
||||
final_output: true
|
||||
final_output_type: image
|
||||
is_comprehension: false
|
||||
default_sampling_params:
|
||||
seed: 52
|
||||
|
||||
# Runtime edges
|
||||
runtime:
|
||||
enabled: true
|
||||
|
||||
connectors:
|
||||
shared_memory_connector:
|
||||
name: SharedMemoryConnector
|
||||
extra:
|
||||
shm_threshold_bytes: 65536
|
||||
|
||||
edges:
|
||||
- from: 0
|
||||
to: 1
|
||||
@@ -1,72 +0,0 @@
|
||||
# Stage config for BAGEL SP: ulysses=2 (2 GPUs)
|
||||
|
||||
stage_args:
|
||||
- stage_id: 0
|
||||
stage_type: llm
|
||||
prompt_expand_func: vllm_omni.model_executor.stage_input_processors.bagel.expand_cfg_prompts
|
||||
runtime:
|
||||
devices: "0"
|
||||
max_batch_size: 1
|
||||
engine_args:
|
||||
model_stage: thinker
|
||||
model_arch: OmniBagelForConditionalGeneration
|
||||
worker_type: ar
|
||||
scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler
|
||||
gpu_memory_utilization: 0.45
|
||||
enforce_eager: true
|
||||
trust_remote_code: true
|
||||
engine_output_type: text
|
||||
distributed_executor_backend: "mp"
|
||||
enable_prefix_caching: false
|
||||
max_num_batched_tokens: 32768
|
||||
tensor_parallel_size: 1
|
||||
omni_kv_config:
|
||||
need_send_cache: true
|
||||
kv_transfer_criteria:
|
||||
type: prefill_finished
|
||||
final_output: true
|
||||
final_output_type: text
|
||||
is_comprehension: true
|
||||
default_sampling_params:
|
||||
temperature: 0.4
|
||||
top_p: 0.9
|
||||
top_k: 1
|
||||
max_tokens: 2048
|
||||
seed: 52
|
||||
detokenize: True
|
||||
repetition_penalty: 1.05
|
||||
|
||||
- stage_id: 1
|
||||
stage_type: diffusion
|
||||
cfg_kv_collect_func: vllm_omni.model_executor.stage_input_processors.bagel.collect_cfg_kv_caches
|
||||
runtime:
|
||||
# devices: "0,1,2,3"
|
||||
devices: "0,1"
|
||||
max_batch_size: 1
|
||||
engine_args:
|
||||
model_stage: dit
|
||||
enforce_eager: true
|
||||
trust_remote_code: true
|
||||
distributed_executor_backend: "mp"
|
||||
parallel_config:
|
||||
ulysses_degree: 2
|
||||
# ring_degree: 2
|
||||
omni_kv_config:
|
||||
need_recv_cache: true
|
||||
engine_input_source: [0]
|
||||
final_output: true
|
||||
final_output_type: image
|
||||
is_comprehension: false
|
||||
default_sampling_params:
|
||||
seed: 52
|
||||
|
||||
runtime:
|
||||
enabled: true
|
||||
connectors:
|
||||
shared_memory_connector:
|
||||
name: SharedMemoryConnector
|
||||
extra:
|
||||
shm_threshold_bytes: 65536
|
||||
edges:
|
||||
- from: 0
|
||||
to: 1
|
||||
Reference in new issue
Block a user