[Model] Add opt-in packed Flow and batched HiFT inference for CosyVoice3 (#8224)

Signed-off-by: Sy03 <1370724210@qq.com>
Signed-off-by: zack <huixindaddy@yahoo.com>
Co-authored-by: zack <huixindaddy@yahoo.com>
This commit is contained in:
Sy03andzack authored and GitHub committed 2026-09-29 15:48:36 +00:00
1 parent c85f1a44fb
commit 1ea0ee3b38
28 files changed
+4009 -223

No files matched your search

@@ -0,0 +1,62 @@
# Opt-in single-Hopper full-response throughput profile (not streaming TTFP).
# Stage 1 selects the packed backend through its environment below.
# The 4096-frame internal boundary exceeds this profile's 2048-token output cap.
async_chunk: true
connectors:
connector_of_shared_memory:
extra:
codec_chunk_frames: 4096
codec_left_context_frames: 25
codec_streaming: true
codec_vocab_size: 6561
connector_get_max_wait: 300
connector_get_max_wait_first_chunk: 3000
connector_get_sleep_s: 0.01
name: SharedMemoryConnector
cuda_mps: true
pipeline: cosyvoice3
stages:
- default_sampling_params:
max_tokens: 2048
repetition_penalty: 1.0001
temperature: 1.0
top_k: 25
top_p: 0.8
devices: '0'
disable_hybrid_kv_cache_manager: true
# Prompt embedding rearrangement requires the complete prefill block.
enable_chunked_prefill: false
enable_prefix_caching: false
enforce_eager: false
gpu_memory_utilization: 0.4
max_num_batched_tokens: 32768
max_num_seqs: 64
mm_processor_cache_gb: 0
# The talker runs on Model Runner V2 (both RAS and standard sampling);
# set model_runner: v1 to fall back. The codec stage stays on V1.
model_runner: v2
output_connectors:
to_stage_1: connector_of_shared_memory
skip_mm_profiling: true
stage_id: 0
trust_remote_code: true
- default_sampling_params:
max_tokens: 2048
devices: '0'
disable_hybrid_kv_cache_manager: true
enable_prefix_caching: false
enforce_eager: true
gpu_memory_utilization: 0.25
input_connectors:
from_stage_0: connector_of_shared_memory
max_model_len: 32768
max_num_batched_tokens: 32768
max_num_seqs: 8
skip_mm_profiling: true
stage_id: 1
env:
COSYVOICE3_TRT: "0"
COSYVOICE3_BATCH_FLOW: "1"
COSYVOICE3_FULL_RESPONSE_OPTIMIZATIONS: "1"
COSYVOICE3_PACKED_STREAMING: "0"
trust_remote_code: true
@@ -0,0 +1,19 @@
# Opt-in single-Hopper C64 throughput profile: one AR and two codec replicas.
# Inherit sampling, connector, and runtime settings from the full-response profile.
# Each stage has aggregate capacity 64; this is not a streaming TTFP profile.
# One Model Runner V2 talker serves all 64 requests: a decode step costs about
# the same at 32 and 64 rows, so a second talker only adds processes. The
# codec is the throughput limit; two replicas overlap its launch-bound steps.
base_config: cosyvoice3_full_response.yaml
stages:
- stage_id: 0
devices: "0"
num_replicas: 1
gpu_memory_utilization: 0.35
max_num_seqs: 64
- stage_id: 1
devices: "0,0"
num_replicas: 2
gpu_memory_utilization: 0.2
max_num_seqs: 32
@@ -0,0 +1,15 @@
# Standard (non-RAS) sampling variant of the C64 throughput profile, used for
# SGLang-parity validation. Launch with
# --hf-overrides '{"cosyvoice3_sampling_mode": "standard"}'.
# Standard sampling needs a real repetition penalty (RAS handles repetition
# itself); these defaults match the SGLang reference.
base_config: cosyvoice3_full_response_high_concurrency.yaml
stages:
- stage_id: 0
default_sampling_params:
max_tokens: 2048
repetition_penalty: 1.21
temperature: 0.7
top_k: 20
top_p: 0.8
@@ -0,0 +1,18 @@
# Opt-in single-Hopper streaming profile: AR64 / codec16, Flow10.
# Request stream=true to measure first audible audio; non-stream latency is not TTFP.
# Keeps each request's HiFT mel/phase state on GPU and uses mainline GPU FP32 F0.
# Shared serving settings come from the full-response profile; only chunk
# boundaries, codec admission capacity, and stage environment differ.
base_config: cosyvoice3_full_response.yaml
connectors:
connector_of_shared_memory:
extra:
codec_chunk_frames: 25
stages:
- stage_id: 1
env:
COSYVOICE3_TRT: "0"
COSYVOICE3_BATCH_FLOW: "1"
COSYVOICE3_FULL_RESPONSE_OPTIMIZATIONS: "0"
COSYVOICE3_PACKED_STREAMING: "1"
max_num_seqs: 16