Views
No views yet
| Base model | canopylabs/3b-hi-pretrain-research_release |
| Dataset | ai4bharat/Rasa — Hindi config, Male speaker |
| Train examples | 12,116 utterances (~23.78 hours) |
| Codec | SNAC 24kHz (hubertsiuzdak/snac_24khz) |
| LoRA rank | 32 (RSLoRA, α=64) |
| LoRA targets | All attention + MLP projections + lm_head + embed_tokens |
| Epochs | 3 |
| Batch size | 4 (effective, grad accum) |
| Learning rate | 2e-4 (cosine schedule) |
| Hardware | 1× NVIDIA A100-SXM4-40GB |
temperature=0.4, top_p=0.9, repetition_penalty=1.1.1import torch
2import wave
3import numpy as np
4from snac import SNAC
5from transformers import AutoModelForCausalLM, AutoTokenizer
6
7MODEL_ID = "edzsaji26/orpheus-3b-0.1-hindi-male-lora"
8VOICE_NAME = "arjun"
9AUDIO_OFFSET = 128266
10STOP_TOKEN = 128258
11SAMPLE_RATE = 24_000
12
13device = "cuda" if torch.cuda.is_available() else "cpu"
14
15tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
16model = AutoModelForCausalLM.from_pretrained(MODEL_ID, torch_dtype=torch.bfloat16, device_map="auto")
17model.eval()
18
19snac = SNAC.from_pretrained("hubertsiuzdak/snac_24khz").eval().to(device)
20
21def synthesise(text):
22 prompt = f"{VOICE_NAME}: {text}"
23 ids = tokenizer(prompt, return_tensors="pt").input_ids
24 input_ids = torch.cat([
25 torch.tensor([[128259]]),
26 ids,
27 torch.tensor([[128009, 128260, 128261, 128257]])
28 ], dim=1).to(device)
29
30 with torch.inference_mode():
31 out = model.generate(
32 input_ids=input_ids,
33 max_new_tokens=2000,
34 do_sample=True,
35 temperature=0.4,
36 top_p=0.9,
37 repetition_penalty=1.1,
38 eos_token_id=STOP_TOKEN,
39 )
40
41 new_tokens = out[0, input_ids.shape[1]:].tolist()
42 audio_tokens = [t for t in new_tokens if t != STOP_TOKEN]
43 n_frames = len(audio_tokens) // 7
44 audio_tokens = audio_tokens[:n_frames * 7]
45
46 c0, c1, c2 = [], [], []
47 for f in range(n_frames):
48 i = f * 7
49 c0.append(audio_tokens[i] - AUDIO_OFFSET)
50 c1.append(audio_tokens[i+1] - AUDIO_OFFSET - 4096)
51 c2.append(audio_tokens[i+2] - AUDIO_OFFSET - 2*4096)
52 c2.append(audio_tokens[i+3] - AUDIO_OFFSET - 3*4096)
53 c1.append(audio_tokens[i+4] - AUDIO_OFFSET - 4*4096)
54 c2.append(audio_tokens[i+5] - AUDIO_OFFSET - 5*4096)
55 c2.append(audio_tokens[i+6] - AUDIO_OFFSET - 6*4096)
56
57 codes = [torch.tensor(c0).unsqueeze(0).to(device),
58 torch.tensor(c1).unsqueeze(0).to(device),
59 torch.tensor(c2).unsqueeze(0).to(device)]
60
61 with torch.inference_mode():
62 audio = snac.decode(codes)
63
64 waveform = audio.squeeze().cpu().numpy()
65 int16 = (waveform * 32767).clip(-32768, 32767).astype(np.int16)
66
67 with wave.open("output.wav", "wb") as wf:
68 wf.setnchannels(1)
69 wf.setsampwidth(2)
70 wf.setframerate(SAMPLE_RATE)
71 wf.writeframes(int16.tobytes())
72
73synthesise("नमस्ते, मेरा नाम अर्जुन है और मैं आपसे बात करके बहुत खुश हूँ।")arjun: <hindi text here>arjun is the learned speaker identity — always include it as the prefix.1@misc{orpheus2025,
2 title = {Orpheus TTS},
3 author = {Canopy Labs},
4 year = {2025},
5 url = {https://github.com/canopyai/Orpheus-TTS}
6}
7
8@inproceedings{ai4bharat2024rasa,
9 author = {Praveen Srinivasa Varadhan and Ashwin Sankar and Giri Raju and Mitesh M. Khapra},
10 title = {Rasa: Building Expressive Speech Synthesis Systems for Indian Languages in Low-resource Settings},
11 booktitle = {Proc. INTERSPEECH 2024},
12 year = {2024}
13}