This is a fine-tuned version of
canopylabs/3b-hi-pretrain-research_release specialized for Hinglish (Hindi-English mixed) text-to-speech generation.
1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3
4# Load model and tokenizer
5model_name = "Itsharshi/tts_300"
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForCausalLM.from_pretrained(
8 model_name,
9 torch_dtype=torch.float16,
10 device_map="auto"
11)
12
13# Generate text
14prompt = "Hello doston, main aapka dost hun"
15inputs = tokenizer(prompt, return_tensors="pt")
16outputs = model.generate(**inputs, max_new_tokens=1200)
This model generates audio tokens that need to be decoded using a SNAC (Scalable Neural Audio Codec) model:
1from snac import SNAC
2
3# Load SNAC decoder
4snac_model = SNAC.from_pretrained("hubertsiuzdak/snac_24khz")
5
6# Process generated tokens to audio codes and decode
7# (See full implementation in the original training code)
1@misc{canopylabs-3b-hi,
2 title={3B Hindi Pretrained Model},
3 author={Canopy Labs},
4 year={2024},
5 url={https://huggingface.co/canopylabs/3b-hi-pretrain-research_release}
6}