#1944·CosyVoice

CosyVoice2: is multi-utterance batch (B>1) inference supported or planned?

Author: James-Bond123Created Sep 9, 2026Updated Sep 10, 2026

Thanks for the great work. We're serving CosyVoice2-0.5B and want to confirm whether batched inference (B>1) is supported.

From the code, inference looks single-utterance only:

cosyvoice/flow/flow.py: assert token.shape[0] == 1 (in both MaskedDiffWithXvec / CausalMaskedDiffWithXvec inference) cosyvoice/cli/model.py: each tts() spawns a per-request thread with per-uuid dicts; tokens wrapped to (1, N) cosyvoice/llm/llm.py: AR decode hard-codes (1,1,T,T) masks and samples .item() per step Training forward clearly uses a real batch dim (make_pad_mask(lengths), pad_sequence), so the weights are batch-capable.

Is batch=1 by design for inference? Any official plan / recommended pattern for B>1 decoding (LLM + Flow + HiFi-GAN)? We need it because on some accelerators (e.g. Ascend NPU) one batched graph is supported but multiple concurrent batch=1 graphs are not. Thanks!