add voxcpm model image

This commit is contained in:
jhqxxx
2025-10-15 22:32:47 +08:00
parent 0fd3c7d935
commit b9dcaec3e6
3 changed files with 7 additions and 3 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

+7 -1
View File
@@ -42,6 +42,11 @@ pub struct CausalConvTranspose1d {
output_padding: usize,
}
// 元素间:stride-1
// 两边: k-p-1
// (h-1)*s -2p+k
// (h+1)*s
impl CausalConvTranspose1d {
pub fn new(
weight: Tensor,
@@ -161,6 +166,7 @@ impl Snake1d {
Ok(Self { alpha })
}
// x + sin(alpha*x)^2 / alpha
pub fn forward(&self, x: &Tensor) -> Result<Tensor> {
let dims = x.dims();
let x = x.reshape((dims[0], dims[1], ()))?;
@@ -192,7 +198,7 @@ impl CausalResidualUnit {
kernel: usize,
groups: usize,
) -> Result<Self> {
let pad = ((7 - 1) * dilation) / 2;
let pad = ((kernel - 1) * dilation) / 2;
let block0 = Snake1d::new(vb.pp("block.0"), dim)?;
let block1 =
WNCausalConv1d::new(vb.pp("block.1"), dim, dim, kernel, dilation, pad, groups, 1)?;
-2
View File
@@ -598,12 +598,10 @@ impl VoxCPMModel {
inference_timesteps,
cfg_value,
)?;
println!("laten_pred: {}", latent_pred);
let decode_audio = self
.audio_vae
.decode(&latent_pred.to_dtype(DType::F32)?)?
.squeeze(1)?;
println!("decode_audio: {}", decode_audio);
let decode_audio_len = decode_audio.dim(D::Minus1)? - 640 - 640;
let decode_audio = decode_audio.narrow(D::Minus1, 640, decode_audio_len)?;
Ok(decode_audio)