Views
No views yet
bfloat16, bypassing standard PyTorch 32-bit overhead and cutting memory usage in half.PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True was enabled, which prevented debilitating VRAM fragmentation crashes during dynamic context length generation and gradient accumulation.batch_size: 1 paired with grad_accum_steps: 32 (effective batch size 32) and capped max_batch_tokens: 3000 to prevent unpredictable sequence lengths from OOMing the 48GB limit during backward passes.val loss: 0.8210), but this repository contains the final converged weights at step 1122).voxcpm repository:1import sys
2import torch
3import soundfile as sf
4import os
5
6# Ensure you have cloned the VoxCPM repo and added it to your python path
7sys.path.insert(0, "/path/to/VoxCPM/src")
8import voxcpm
9
10# 1. Provide the path to these downloaded HF weights
11model_path = "./voxcpm2-finetuned-100hr"
12
13# 2. Initialize the model
14model = voxcpm.VoxCPM(voxcpm_model_path=model_path)
15
16# 3. Enter your target text
17text = "ধান ফুরাল, পান ফুরাল, খাজনার উপায় কী? আর কটা দিন সবুর করো, রসুন বুনেছি।"
18
19print(f"Generating audio for text: '{text}'")
20
21# 4. Generate
22wav = model.generate(
23 text=text,
24 cfg_value=2.0,
25 inference_timesteps=10,
26 normalize=True,
27 denoise=False
28)
29
30# 5. Save the output
31output_path = "output.wav"
32sample_rate = model.tts_model.sample_rate
33sf.write(output_path, wav, sample_rate)
34print(f"✅ Success! Audio saved to {output_path}")