fix voxcpm narrow bug

This commit is contained in:
jhqxxx
2026-04-25 18:43:36 +08:00
parent e45014b8e0
commit 001e4e00f5
+7 -1
View File
@@ -366,7 +366,13 @@ impl VoxCPMModelRefact {
&& let Some(audio_mask) = &audio_mask
{
let audio_len = audio_mask.dim(1)?;
if audio_mask.narrow(1, audio_len - 1, 1)?.to_scalar::<u32>()? == 1 {
if audio_mask
.narrow(1, audio_len - 1, 1)?
.squeeze(0)?
.squeeze(0)?
.to_scalar::<u32>()?
== 1
{
let audio_len = audio_mask.sum_all()?.to_scalar::<u32>()? as usize;
let context_len = audio_len.min(streaming_prefix_len - 1);
let start = audio_feat.dim(1)? - context_len;