Views
No views yet
LiquidAI/LFM2.5-Audio-1.5B-JP, trained on Japanese station announcement clips from 3bitquantizers/jp-station-full-v2-vad-trimmed-openai-clip-asr-strict.Perform TTS in japanese.LiquidAI/LFM2.5-Audio-1.5B-JP3bitquantizers/jp-station-full-v2-vad-trimmed-openai-clip-asr-strictliquid-audio package.1import soundfile as sf
2import torch
3from liquid_audio import ChatState, LFM2AudioModel, LFM2AudioProcessor
4
5repo_id = "3bitquantizers/LFM2.5-Audio-1.5B-JP-jp-station-v2-vad-trimmed"
6prompt = "次は、渋谷、渋谷です。お出口は右側です。"
7
8processor = LFM2AudioProcessor.from_pretrained(repo_id, device="cuda").eval()
9model = LFM2AudioModel.from_pretrained(repo_id, device="cuda", dtype=torch.bfloat16).eval()
10
11chat = ChatState(processor)
12chat.new_turn("system")
13chat.add_text("Perform TTS in japanese.")
14chat.end_turn()
15chat.new_turn("user")
16chat.add_text(prompt)
17chat.end_turn()
18chat.new_turn("assistant")
19
20frames = []
21with torch.no_grad():
22 for token in model.generate_sequential(
23 **chat,
24 max_new_tokens=512,
25 text_temperature=None,
26 text_top_k=1,
27 audio_temperature=0.8,
28 audio_top_k=4,
29 ):
30 if token.numel() == 1:
31 continue
32 if token[0].item() == 2048:
33 break
34 frames.append(token.detach())
35
36codes = torch.stack(frames, dim=1).to(device="cuda", dtype=torch.long)
37wav = processor.mimi.eval().decode(codes.unsqueeze(0))[0].float().cpu().squeeze()
38sf.write("sample.wav", wav.numpy(), 24_000)