Instructions to use actorcritic/voxcpm2-finetuned-100hr with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- VoxCPM
How to use actorcritic/voxcpm2-finetuned-100hr with VoxCPM:
import soundfile as sf from voxcpm import VoxCPM model = VoxCPM.from_pretrained("actorcritic/voxcpm2-finetuned-100hr") wav = model.generate( text="VoxCPM is an innovative end-to-end TTS model from ModelBest, designed to generate highly expressive speech.", prompt_wav_path=None, # optional: path to a prompt speech for voice cloning prompt_text=None, # optional: reference text cfg_value=2.0, # LM guidance on LocDiT, higher for better adherence to the prompt, but maybe worse inference_timesteps=10, # LocDiT inference timesteps, higher for better result, lower for fast speed normalize=True, # enable external TN tool denoise=True, # enable external Denoise tool retry_badcase=True, # enable retrying mode for some bad cases (unstoppable) retry_badcase_max_times=3, # maximum retrying times retry_badcase_ratio_threshold=6.0, # maximum length restriction for bad case detection (simple but effective), it could be adjusted for slow pace speech ) sf.write("output.wav", wav, 16000) print("saved: output.wav") - Notebooks
- Google Colab
- Kaggle
VoxCPM2 Fine-Tuned (Bengali - 100 Hours)
This is a fine-tuned version of the VoxCPM2 model, optimized for Bengali text-to-speech generation. It was trained on a 100-hour Bengali speech dataset.
Fine-tuning Details & Optimizations
Training a massive 3-billion parameter multimodal architecture normally requires multiple A100s. To squeeze the entire fine-tuning pipeline onto a single 48GB GPU (NVIDIA RTX A6000), the following advanced optimizations were utilized:
- bfloat16 Native Execution: Model weights and gradients were cast natively to
bfloat16, bypassing standard PyTorch 32-bit overhead and cutting memory usage in half. - 8-bit AdamW (BitsAndBytes): The optimizer states were heavily quantized, reducing the optimizer VRAM footprint from ~24 GB down to ~6 GB without sacrificing convergence stability.
- Expandable Segments: PyTorch's
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:Truewas enabled, which prevented debilitating VRAM fragmentation crashes during dynamic context length generation and gradient accumulation. - Memory-Optimized DataLoader: Arrow-format datasets were pre-cached, bypassing redundant mapping/casting during initialization and radically improving dataset streaming speed.
- Strict Memory Clamping:
batch_size: 1paired withgrad_accum_steps: 32(effective batch size 32) and cappedmax_batch_tokens: 3000to prevent unpredictable sequence lengths from OOMing the 48GB limit during backward passes.
Final Training Metrics:
- Final Training Diff Loss: 0.9512
- Final Validation Diff Loss: 0.9539
(Note: The checkpoint with the lowest validation loss was actually step 500 (val loss: 0.8210), but this repository contains the final converged weights at step 1122).
Inference Ready Code
You can use this model instantly by loading it with the official voxcpm repository:
import sys
import torch
import soundfile as sf
import os
# Ensure you have cloned the VoxCPM repo and added it to your python path
sys.path.insert(0, "/path/to/VoxCPM/src")
import voxcpm
# 1. Provide the path to these downloaded HF weights
model_path = "./voxcpm2-finetuned-100hr"
# 2. Initialize the model
model = voxcpm.VoxCPM(voxcpm_model_path=model_path)
# 3. Enter your target text
text = "ধান ফুরাল, পান ফুরাল, খাজনার উপায় কী? আর কটা দিন সবুর করো, রসুন বুনেছি।"
print(f"Generating audio for text: '{text}'")
# 4. Generate
wav = model.generate(
text=text,
cfg_value=2.0,
inference_timesteps=10,
normalize=True,
denoise=False
)
# 5. Save the output
output_path = "output.wav"
sample_rate = model.tts_model.sample_rate
sf.write(output_path, wav, sample_rate)
print(f"✅ Success! Audio saved to {output_path}")
- Downloads last month
- 20