Skip to content

Commit 4642b60

Browse files
Deep-unlearningWauplinVaibhavs10
authored
add vibevoice snippet (#1756)
Waiting for these pr to be merged : https://huggingface.co/aoi-ot/VibeVoice-1.5B/discussions/1 https://huggingface.co/aoi-ot/VibeVoice-7B/discussions/1 https://huggingface.co/aoi-ot/VibeVoice-Large/discussions/7 --------- Co-authored-by: Lucain <lucain@huggingface.co> Co-authored-by: vb <vaibhavs10@gmail.com>
1 parent 123f19a commit 4642b60

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

packages/tasks/src/model-libraries-snippets.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,6 +1699,29 @@ image = sana(
16991699
) `,
17001700
];
17011701

1702+
export const vibevoice = (model: ModelData): string[] => [
1703+
`import torch, soundfile as sf, librosa, numpy as np
1704+
from vibevoice.processor.vibevoice_processor import VibeVoiceProcessor
1705+
from vibevoice.modular.modeling_vibevoice_inference import VibeVoiceForConditionalGenerationInference
1706+
1707+
# Load voice sample (should be 24kHz mono)
1708+
voice, sr = sf.read("path/to/voice_sample.wav")
1709+
if voice.ndim > 1: voice = voice.mean(axis=1)
1710+
if sr != 24000: voice = librosa.resample(voice, sr, 24000)
1711+
1712+
processor = VibeVoiceProcessor.from_pretrained("${model.id}")
1713+
model = VibeVoiceForConditionalGenerationInference.from_pretrained(
1714+
"${model.id}", torch_dtype=torch.bfloat16
1715+
).to("cuda").eval()
1716+
model.set_ddpm_inference_steps(5)
1717+
1718+
inputs = processor(text=["Speaker 0: Hello!\\nSpeaker 1: Hi there!"],
1719+
voice_samples=[[voice]], return_tensors="pt")
1720+
audio = model.generate(**inputs, cfg_scale=1.3,
1721+
tokenizer=processor.tokenizer).speech_outputs[0]
1722+
sf.write("output.wav", audio.cpu().numpy().squeeze(), 24000)`,
1723+
];
1724+
17021725
export const videoprism = (model: ModelData): string[] => [
17031726
`# Install from https://github.com/google-deepmind/videoprism
17041727
import jax

packages/tasks/src/model-libraries.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,13 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
12501250
countDownloads: `path_extension:"pt"`,
12511251
snippets: snippets.vui,
12521252
},
1253+
vibevoice: {
1254+
prettyLabel: "VibeVoice",
1255+
repoName: "VibeVoice",
1256+
repoUrl: "https://github.com/microsoft/VibeVoice",
1257+
snippets: snippets.vibevoice,
1258+
filter: false,
1259+
},
12531260
"wan2.2": {
12541261
prettyLabel: "Wan2.2",
12551262
repoName: "Wan2.2",

0 commit comments

Comments
 (0)