From c8224bd1997e56a5b895752b9fef55c9d3ad15f8 Mon Sep 17 00:00:00 2001 From: Cocoon-Break <54054995+kuishou68@users.noreply.github.com> Date: Mon, 1 Jun 2026 16:55:40 +0800 Subject: [PATCH 1/3] fix: use Optional[int] for kv_channels in config.py Co-authored-by: kuishou68 <54054995+kuishou68@users.noreply.github.com> --- src/voxcpm/modules/minicpm4/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/voxcpm/modules/minicpm4/config.py b/src/voxcpm/modules/minicpm4/config.py index 332dd11c..821dc390 100644 --- a/src/voxcpm/modules/minicpm4/config.py +++ b/src/voxcpm/modules/minicpm4/config.py @@ -1,5 +1,5 @@ from pydantic import BaseModel -from typing import List +from typing import List, Optional class RopeScalingConfig(BaseModel): @@ -26,5 +26,5 @@ class MiniCPM4Config(BaseModel): dim_model_base: int scale_depth: float rope_theta: float - kv_channels: int = None + kv_channels: Optional[int] = None no_rope: bool = False From dc1934439381de94335a0ddea51533d9c0cb5f8f Mon Sep 17 00:00:00 2001 From: Cocoon-Break <54054995+kuishou68@users.noreply.github.com> Date: Mon, 1 Jun 2026 16:55:46 +0800 Subject: [PATCH 2/3] fix: use Optional[int] for out_dim in local_dit.py Co-authored-by: kuishou68 <54054995+kuishou68@users.noreply.github.com> --- src/voxcpm/modules/locdit/local_dit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/voxcpm/modules/locdit/local_dit.py b/src/voxcpm/modules/locdit/local_dit.py index 521c7c77..aaba8f66 100644 --- a/src/voxcpm/modules/locdit/local_dit.py +++ b/src/voxcpm/modules/locdit/local_dit.py @@ -1,4 +1,5 @@ import torch +from typing import Optional from ..minicpm4 import MiniCPMModel, MiniCPM4Config import torch.nn as nn import math @@ -27,7 +28,7 @@ def __init__( self, in_channels: int, time_embed_dim: int, - out_dim: int = None, + out_dim: Optional[int] = None, ): super().__init__() From 2d6d78a7789c40fda11f1112486387a5b52d54ec Mon Sep 17 00:00:00 2001 From: Cocoon-Break <54054995+kuishou68@users.noreply.github.com> Date: Mon, 1 Jun 2026 16:55:49 +0800 Subject: [PATCH 3/3] fix: use Optional[str] for nullable str params in core.py Fix cache_dir, prompt_wav_path, prompt_text, and reference_wav_path. Co-authored-by: kuishou68 <54054995+kuishou68@users.noreply.github.com> --- src/voxcpm/core.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/voxcpm/core.py b/src/voxcpm/core.py index f5e82b44..c48b7e18 100644 --- a/src/voxcpm/core.py +++ b/src/voxcpm/core.py @@ -91,7 +91,7 @@ def from_pretrained( hf_model_id: str = "openbmb/VoxCPM2", load_denoiser: bool = True, zipenhancer_model_id: str = "iic/speech_zipenhancer_ans_multiloss_16k_base", - cache_dir: str = None, + cache_dir: Optional[str] = None, local_files_only: bool = False, optimize: bool = True, lora_config: Optional[LoRAConfig] = None, @@ -160,9 +160,9 @@ def generate_streaming(self, *args, **kwargs) -> Generator[np.ndarray, None, Non def _generate( self, text: str, - prompt_wav_path: str = None, - prompt_text: str = None, - reference_wav_path: str = None, + prompt_wav_path: Optional[str] = None, + prompt_text: Optional[str] = None, + reference_wav_path: Optional[str] = None, cfg_value: float = 2.0, inference_timesteps: int = 10, min_len: int = 2,