@@ -1684,6 +1684,29 @@ image = sana(
1684
1684
) ` ,
1685
1685
] ;
1686
1686
1687
+ export const vibevoice = ( model : ModelData ) : string [ ] => [
1688
+ `import torch, soundfile as sf, librosa, numpy as np
1689
+ from vibevoice.processor.vibevoice_processor import VibeVoiceProcessor
1690
+ from vibevoice.modular.modeling_vibevoice_inference import VibeVoiceForConditionalGenerationInference
1691
+
1692
+ # Load voice sample (should be 24kHz mono)
1693
+ voice, sr = sf.read("path/to/voice_sample.wav")
1694
+ if voice.ndim > 1: voice = voice.mean(axis=1)
1695
+ if sr != 24000: voice = librosa.resample(voice, sr, 24000)
1696
+
1697
+ processor = VibeVoiceProcessor.from_pretrained("${ model . id } ")
1698
+ model = VibeVoiceForConditionalGenerationInference.from_pretrained(
1699
+ "${ model . id } ", torch_dtype=torch.bfloat16
1700
+ ).to("cuda").eval()
1701
+ model.set_ddpm_inference_steps(5)
1702
+
1703
+ inputs = processor(text=["Speaker 0: Hello!\\nSpeaker 1: Hi there!"],
1704
+ voice_samples=[[voice]], return_tensors="pt")
1705
+ audio = model.generate(**inputs, cfg_scale=1.3,
1706
+ tokenizer=processor.tokenizer).speech_outputs[0]
1707
+ sf.write("output.wav", audio.cpu().numpy().squeeze(), 24000)` ,
1708
+ ] ;
1709
+
1687
1710
export const videoprism = ( model : ModelData ) : string [ ] => [
1688
1711
`# Install from https://github.com/google-deepmind/videoprism
1689
1712
import jax
0 commit comments