Ascend NPU adapted version of openbmb/VoxCPM2 — tokenizer-free diffusion autoregressive TTS, 2B parameters, 30 languages, 48kHz output via AudioVAE V2. Original model: https://huggingface.co/openbmb/VoxCPM2
torch.npu.is_available() and torch.npu.get_device_name(0) = Ascend910_9362openbmb/VoxCPM2 (model.safetensors 4.3GB + audiovae.pth 360MB)config.json architecture voxcpm2, lm_config 28 layers hidden 2048, sampling_rate 16000 → out 48000, dtype bfloat16voxcpm.model.utils to support npu:0 (upstream only cuda/mps/cpu): _has_npu, auto_select_device, resolve_runtime_device, pick_runtime_dtype keep bfloat16 for NPUAudioVAE.decode to temporarily disable torch.backends.mkldnn.enabled to avoid Xbyak illegal immediate parameter bug on CPU with dilation=9 for T>=10 (oneDNN JIT). NPU generation keeps MKLDNN enabled for speed (6s/it vs 34s/it), decode disables only for that op.optimize=False (torch.compile only supports CUDA + triton), bfloat16 kept; AudioVAE always float32MODEL_DIR (no online download), device explicitly npu:0 with torch.npu.synchronize() around timingpip install -r requirements.txt
# NPU
python inference.py --device npu:0 --text "Hello world, welcome to VoxCPM2." --output output.wav
# CPU baseline
python inference.py --device cpu --text "Hello world, welcome to VoxCPM2." --output cpu.wavOptional env: VOXCPM_MODEL_DIR=/path/to/openbmb-VoxCPM2
Default params: cfg_value=2.0 inference_timesteps=10 max_len=80 seed=42
text (str) + optional reference_wav_path/prompt_wav_path for cloning (same text/device/dtype preprocessing). Tested with Hello world, welcome to VoxCPM2. (32 chars) and voice-design (A young woman, gentle and sweet voice)Hello, welcome!.waveform np.ndarray float32, shape [N], sample_rate=48000, finite, non-silent (rms>1e-4, clipping<0.05), duration N/48000.[DEVICE_PROOF] npu model device: npu:0
[DEVICE_PROOF] npu param device: npu:0
[DEVICE_PROOF] tts_model.device: npu:0
[INFO] device_name 0: Ascend910_9362Fixed seed 42, same bfloat16, truncated to min length 153600:
Note: VoxCPM2 diffusion sampling is stochastic and NPU vs CPU floating differences amplify via autoregressive loop, causing larger spectral divergence than deterministic models. Thresholds set accordingly before run.
torch.npu.synchronize() before/after
