Noothi/telugu-tech-indicf5-custom-voice
Updated • 88
How to use Noothi/telugu-indicf5-combined-v2 with F5-TTS:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
A fine-tuned variant of ai4bharat/IndicF5 on single-speaker Telugu tech-domain speech (~1093 combined samples from v1 + v2).
| File | Description |
|---|---|
model_last.pt |
F5-TTS native checkpoint (5.4 GB) with ema_model_state_dict + model_state_dict |
vocab.txt |
Character vocabulary (mirror of ai4bharat/IndicF5) |
prompts/sample_ref.wav |
Example reference clip (~6s) |
prompts/sample_ref.txt |
Transcript of the reference clip |
samples/test_output.wav |
Sanity-check inference output (base model) |
This fork's load_model does not accept a checkpoint path, so we load it manually.
import torch
import soundfile as sf
from cached_path import cached_path
from f5_tts.model import DiT, CFM
from f5_tts.infer.utils_infer import (
load_vocoder,
infer_process,
get_tokenizer,
n_mel_channels,
)
REPO = "Noothi/telugu-indicf5-combined-v2"
# Download files
ckpt_path = cached_path(f"hf://{REPO}/model_last.pt")
vocab_path = cached_path(f"hf://{REPO}/vocab.txt")
device = "cuda"
# Load vocoder
vocoder = load_vocoder(
"vocos",
is_local=False,
device=device,
)
# Load tokenizer and vocabulary size
vocab_char_map, vocab_size = get_tokenizer(
vocab_path,
"custom",
)
# Build model
model_cfg = dict(
dim=1024,
depth=22,
heads=16,
ff_mult=2,
text_dim=512,
conv_layers=4,
)
model = CFM(
transformer=DiT(
**model_cfg,
text_num_embeds=vocab_size,
mel_dim=n_mel_channels,
),
mel_spec_kwargs=dict(
n_fft=1024,
hop_length=256,
win_length=1024,
n_mel_channels=n_mel_channels,
target_sample_rate=24000,
mel_spec_type="vocos",
),
)
model = model.to(device)
# Load fine-tuned checkpoint
checkpoint = torch.load(
ckpt_path,
map_location=device,
)
state_dict = checkpoint.get(
"ema_model_state_dict",
checkpoint.get(
"model_state_dict",
checkpoint,
),
)
model.load_state_dict(
state_dict,
strict=False,
)
model.eval()
print("Fine-tuned model loaded successfully!")
# Reference audio and text
ref_audio = "prompts/sample_ref.wav"
ref_text = """మా ఆఫీస్ లో చాలా సార్లు కొంతమంది జావా ఫాస్ట్ అంటారు. ఇంకొంతమంది జావా కాదు నోడ్ జెఎస్ ఇంకా ఫాస్ట్ గా ఉంటది అంటారు. కొంతమందైతే ఆ రెండూ కాదు పైథాన్ సూపర్ గా ఉంటది అంటారు. ఇంకొంతమంది వేరేగా వచ్చి ఆ మూడు కాదు గాని గో, రస్ట్ అని రెండు లాంగ్వేజెస్ ఉన్నాయి అవైతే సూపర్ గా ఉంటాయి అంటారు"""
# Generate speech
wav, sr, _ = infer_process(
ref_audio,
ref_text,
"నమస్తే! మీరు ఎలా ఉన్నారు?",
model,
vocoder,
mel_spec_type="vocos",
device=device,
nfe_step=32,
cfg_strength=2.0,
speed=1.0,
)
sf.write(
"output.wav",
wav,
sr,
)
Continued from Noothi/telugu-indicf5-full-437samples for 10 epochs on the
combined v1 + v2 dataset.
Final step: 2190
Final loss: approximately 0.518
MIT (inherits from base IndicF5).
Base model
ai4bharat/IndicF5