[perf] Minicpm o4.5 optimization (#5228)

Signed-off-by: R2-Y <ruiruyang2@gmail.com>
Co-authored-by: Sy03 <1370724210@qq.com>
This commit is contained in:
rein yangandSy03 authored and GitHub committed 2026-07-24 17:20:39 +08:00
1 parent acf941da4d
commit ad3a162eb8
54 files changed
+3861 -3997

No files matched your search

+41 -16
View File
@@ -1,20 +1,24 @@
# MiniCPM-o 4.5 default deploy: single-GPU layout.
#
# Both stages are co-located on GPU 0:
# Stage 0 (thinker): multimodal understanding, ~80% mem.
# Stage 1 (talker) : MiniCPMTTS + in-process Token2Wav vocoder, ~10% mem
# (talker LM plus the vocoder that emits the waveform).
#
# Other GPU layouts: minicpmo_4_5_3gpu.yaml, minicpmo_4_5_8x4090.yaml.
async_chunk: false
# MiniCPM-o 4.5 three-stage deploy on one large-memory GPU.
pipeline: minicpmo_4_5
async_chunk: true
trust_remote_code: true
enable_prefix_caching: false
connectors:
connector_of_shared_memory:
name: SharedMemoryConnector
extra:
connector_get_sleep_s: 0.01
connector_get_max_wait_first_chunk: 3000
connector_get_max_wait: 300
codec_chunk_frames: 25
codec_left_context_frames: 3
stages:
- stage_id: 0
max_num_seqs: 16
gpu_memory_utilization: 0.8
max_num_seqs: 4
gpu_memory_utilization: 0.65
enforce_eager: false
tensor_parallel_size: 1
max_num_batched_tokens: 16384
@@ -31,21 +35,42 @@ stages:
repetition_penalty: 1.1
- stage_id: 1
# Talker only consumes runtime_additional_information[0]; any value > 1
# makes concurrent requests share request-0's audio (mm_outputs fallback).
max_num_seqs: 1
gpu_memory_utilization: 0.1
max_num_seqs: 4
gpu_memory_utilization: 0.15
enforce_eager: false
max_num_batched_tokens: 8192
devices: "0"
output_connectors:
to_stage_2: connector_of_shared_memory
# Codec sampling comes from the checkpoint's tts_config. These parameters
# govern only vLLM's binary continue/stop token.
default_sampling_params:
temperature: 0.0
top_p: 1.0
top_k: -1
max_tokens: 1
min_tokens: 50
max_tokens: 2048
stop_token_ids: [1]
seed: 42
detokenize: false
- stage_id: 2
max_num_seqs: 4
gpu_memory_utilization: 0.15
enforce_eager: true
enable_chunked_prefill: false
max_num_batched_tokens: 65536
max_model_len: 65536
devices: "0"
input_connectors:
from_stage_1: connector_of_shared_memory
default_sampling_params:
temperature: 0.0
top_p: 1.0
top_k: -1
max_tokens: 65536
detokenize: true
platforms:
npu:
stages:
+2 -64
View File
@@ -1,64 +1,2 @@
# MiniCPM-o 4.5 deploy: 2-GPU layout (thinker on GPU 0, talker on GPU 1).
#
# Stage 0 (thinker): GPU 0 — multimodal understanding, ~90% mem (thinker
# gets a dedicated card, so it can take more of
# the GPU than the single-GPU co-located layout).
# Stage 1 (talker) : GPU 1 — MiniCPMTTS + Token2Wav, ~75% mem
# (covers both the talker LM and the in-process
# Token2Wav vocoder that emits the waveform).
#
# Use this when you have two GPUs and want the talker + Token2Wav vocoder
# on its own card instead of sharing GPU 0 with the thinker (the default
# single-GPU layout co-locates both and can OOM under load).
pipeline: minicpmo_4_5
async_chunk: false
trust_remote_code: true
enable_prefix_caching: false
stages:
- stage_id: 0
max_num_seqs: 16
gpu_memory_utilization: 0.9
enforce_eager: false
tensor_parallel_size: 1
max_num_batched_tokens: 16384
devices: "0"
limit_mm_per_prompt:
video: 1
default_sampling_params:
temperature: 0.0
top_p: 1.0
top_k: -1
max_tokens: 2048
seed: 42
detokenize: true
repetition_penalty: 1.1
- stage_id: 1
# Talker only consumes runtime_additional_information[0]; any value > 1
# makes concurrent requests share request-0's audio (mm_outputs fallback).
max_num_seqs: 1
gpu_memory_utilization: 0.75
enforce_eager: false
max_num_batched_tokens: 8192
devices: "1"
default_sampling_params:
temperature: 0.0
top_p: 1.0
top_k: -1
max_tokens: 1
seed: 42
detokenize: false
platforms:
npu:
stages:
- stage_id: 0
max_num_batched_tokens: 8192
compilation_config:
cudagraph_mode: PIECEWISE
- stage_id: 1
max_num_batched_tokens: 8192
compilation_config:
cudagraph_mode: PIECEWISE
# Backward-compatible name for the canonical two-GPU batching profile.
base_config: minicpmo_4_5_batching.yaml
+45 -16
View File
@@ -1,23 +1,31 @@
# MiniCPM-o 4.5 deploy: 3-GPU layout (thinker TP=2 + talker on GPU 2).
# MiniCPM-o 4.5 three-stage deploy with one GPU per stage.
#
# Stage 0 (thinker): GPU 0,1 — 2-way tensor parallel, ~70% mem each.
# Stage 1 (talker) : GPU 2 — MiniCPMTTS + Token2Wav, ~75% mem
# (covers both the talker LM and the in-process
# Token2Wav vocoder that emits the waveform).
# This replaces the former fused two-stage layout: Thinker, Talker, and
# Code2Wav run independently on GPUs 0, 1, and 2.
pipeline: minicpmo_4_5
async_chunk: false
async_chunk: true
trust_remote_code: true
enable_prefix_caching: false
connectors:
connector_of_shared_memory:
name: SharedMemoryConnector
extra:
connector_get_sleep_s: 0.01
connector_get_max_wait_first_chunk: 3000
connector_get_max_wait: 300
codec_chunk_frames: 25
codec_left_context_frames: 3
stages:
- stage_id: 0
max_num_seqs: 16
gpu_memory_utilization: 0.7
max_num_seqs: 4
gpu_memory_utilization: 0.9
enforce_eager: false
tensor_parallel_size: 2
tensor_parallel_size: 1
max_num_batched_tokens: 16384
devices: "0,1"
devices: "0"
limit_mm_per_prompt:
video: 1
default_sampling_params:
@@ -30,19 +38,40 @@ stages:
repetition_penalty: 1.1
- stage_id: 1
# Talker only consumes runtime_additional_information[0]; any value > 1
# makes concurrent requests share request-0's audio (mm_outputs fallback).
max_num_seqs: 1
gpu_memory_utilization: 0.75
max_num_seqs: 4
gpu_memory_utilization: 0.9
enforce_eager: false
max_num_batched_tokens: 8192
devices: "2"
devices: "1"
output_connectors:
to_stage_2: connector_of_shared_memory
# vLLM samples the binary continue/stop row; codec sampling comes from
# the checkpoint's tts_config and currently uses a deterministic seed.
default_sampling_params:
temperature: 0.0
top_p: 1.0
top_k: -1
max_tokens: 1
min_tokens: 50
max_tokens: 2048
stop_token_ids: [1]
seed: 42
detokenize: false
- stage_id: 2
max_num_seqs: 4
gpu_memory_utilization: 0.9
enforce_eager: true
enable_chunked_prefill: false
max_num_batched_tokens: 65536
max_model_len: 65536
devices: "2"
input_connectors:
from_stage_1: connector_of_shared_memory
default_sampling_params:
temperature: 0.0
top_p: 1.0
top_k: -1
max_tokens: 65536
detokenize: true
platforms: {}
+37 -8
View File
@@ -4,10 +4,8 @@
# thinker weights take ~17.5 GB per card
# on 4090, leaving ~3 GB for KV cache /
# activations).
# Stage 1 (talker) : GPU 4 — MiniCPMTTS + Token2Wav, ~90% mem
# (covers both the talker LM and the
# in-process Token2Wav vocoder that emits
# the waveform).
# Stage 1 (talker) : GPU 4 — MiniCPMTTS codec generation, ~90% mem.
# Stage 2 (code2wav): GPU 5 — codec-to-waveform generation, ~90% mem.
#
# max_model_len is pinned to 4096 because the upstream config.json
# advertises max_position_embeddings=40960 (tuned for H20 141GB); on a
@@ -16,11 +14,21 @@
# this thinker model + vision/audio encoders + Whisper preallocation,
# so 4096 is the empirically-verified safe ceiling.
pipeline: minicpmo_4_5
async_chunk: false
async_chunk: true
trust_remote_code: true
enable_prefix_caching: false
connectors:
connector_of_shared_memory:
name: SharedMemoryConnector
extra:
connector_get_sleep_s: 0.01
connector_get_max_wait_first_chunk: 3000
connector_get_max_wait: 300
codec_chunk_frames: 25
codec_left_context_frames: 3
stages:
- stage_id: 0
max_num_seqs: 1
@@ -42,19 +50,40 @@ stages:
repetition_penalty: 1.1
- stage_id: 1
# Talker only consumes runtime_additional_information[0]; any value > 1
# makes concurrent requests share request-0's audio (mm_outputs fallback).
max_num_seqs: 1
gpu_memory_utilization: 0.9
enforce_eager: true
max_num_batched_tokens: 8192
devices: "4"
output_connectors:
to_stage_2: connector_of_shared_memory
# vLLM samples the binary continue/stop row; codec sampling comes from
# the checkpoint's tts_config and currently uses a deterministic seed.
default_sampling_params:
temperature: 0.0
top_p: 1.0
top_k: -1
max_tokens: 1
min_tokens: 50
max_tokens: 2048
stop_token_ids: [1]
seed: 42
detokenize: false
- stage_id: 2
max_num_seqs: 1
gpu_memory_utilization: 0.9
enforce_eager: true
enable_chunked_prefill: false
max_num_batched_tokens: 65536
max_model_len: 65536
devices: "5"
input_connectors:
from_stage_1: connector_of_shared_memory
default_sampling_params:
temperature: 0.0
top_p: 1.0
top_k: -1
max_tokens: 65536
detokenize: true
platforms: {}
@@ -0,0 +1,88 @@
# MiniCPM-o 4.5 two-GPU continuous-batching layout.
#
# Thinker owns GPU 0. Talker and Code2Wav share GPU 1, keeping text decoding
# isolated from codec/vocoder contention while preserving stage-2 batching.
pipeline: minicpmo_4_5
async_chunk: true
trust_remote_code: true
enable_prefix_caching: false
connectors:
connector_of_shared_memory:
name: SharedMemoryConnector
extra:
connector_get_sleep_s: 0.01
connector_get_max_wait_first_chunk: 3000
connector_get_max_wait: 300
codec_chunk_frames: 25
codec_left_context_frames: 3
stages:
- stage_id: 0
max_num_seqs: 4
gpu_memory_utilization: 0.9
enforce_eager: false
tensor_parallel_size: 1
max_num_batched_tokens: 16384
devices: "0"
limit_mm_per_prompt:
video: 1
default_sampling_params:
temperature: 0.0
top_p: 1.0
top_k: -1
max_tokens: 2048
seed: 42
detokenize: true
repetition_penalty: 1.1
- stage_id: 1
max_num_seqs: 4
gpu_memory_utilization: 0.55
enforce_eager: false
max_num_batched_tokens: 8192
devices: "1"
output_connectors:
to_stage_2: connector_of_shared_memory
# Codec sampling is model-owned by the checkpoint's tts_config (defaults:
# T=0.8, top-k=25, top-p=0.85, repetition penalty=1.05, seed=42).
# These parameters only govern vLLM's binary continue/stop token.
default_sampling_params:
temperature: 0.0
top_p: 1.0
top_k: -1
min_tokens: 50
max_tokens: 2048
stop_token_ids: [1]
seed: 42
detokenize: false
- stage_id: 2
max_num_seqs: 4
gpu_memory_utilization: 0.35
enforce_eager: true
enable_chunked_prefill: false
max_num_batched_tokens: 65536
max_model_len: 65536
devices: "1"
input_connectors:
from_stage_1: connector_of_shared_memory
default_sampling_params:
temperature: 0.0
top_p: 1.0
top_k: -1
max_tokens: 65536
detokenize: true
platforms:
npu:
stages:
- stage_id: 0
max_num_batched_tokens: 8192
compilation_config:
cudagraph_mode: PIECEWISE
- stage_id: 1
max_num_batched_tokens: 8192
compilation_config:
cudagraph_mode: PIECEWISE
+12 -10
View File
@@ -1,9 +1,9 @@
# MiniCPM-o 4.5 native duplex deployment.
#
# The registered minicpmo_4_5 pipeline owns the fixed Stage0 -> Stage1
# topology and llm2tts bridge. This overlay only changes session lifetime and
# the Stage1 token budget needed to drain streaming audio segments.
base_config: minicpmo_4_5.yaml
# The registered minicpmo_4_5 pipeline owns the fixed
# Thinker -> Talker -> Code2Wav topology. This overlay changes session
# lifetime and bounds all three stages to two live duplex sessions.
base_config: minicpmo_4_5_batching.yaml
pipeline: minicpmo_4_5
session_mode: duplex
active_stream_window: 1
@@ -27,10 +27,12 @@ stages:
- stage_id: 1
max_num_seqs: 2
async_scheduling: false
# The streaming talker advances Python-owned per-request generators on
# every step, so only fixed-topology model regions are graph-capturable.
compilation_config:
cudagraph_mode: PIECEWISE
# The split Talker exposes a binary continue/stop vocabulary; native
# segment and turn boundaries travel as explicit output metadata.
default_sampling_params:
max_tokens: 4096
stop_token_ids: [151645]
max_tokens: 2048
stop_token_ids: [1]
- stage_id: 2
max_num_seqs: 2
async_scheduling: false