Skip to content

Commit 8581ca8

Browse files
Deep-unlearningDeep-UnlearningWauplinVaibhavs10
authored
Add Zonos snippet (#1363)
Co-authored-by: Deep-Unlearning <[email protected]> Co-authored-by: Lucain <[email protected]> Co-authored-by: vb <[email protected]>
1 parent b85007a commit 8581ca8

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

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

+19
Original file line numberDiff line numberDiff line change
@@ -1507,4 +1507,23 @@ export const hezar = (model: ModelData): string[] => [
15071507
15081508
model = Model.load("${model.id}")`,
15091509
];
1510+
1511+
export const zonos = (model: ModelData): string[] => [
1512+
`# pip install git+https://github.com/Zyphra/Zonos.git
1513+
import torchaudio
1514+
from zonos.model import Zonos
1515+
from zonos.conditioning import make_cond_dict
1516+
1517+
model = Zonos.from_pretrained("${model.id}", device="cuda")
1518+
1519+
wav, sr = torchaudio.load("speaker.wav") # 5-10s reference clip
1520+
speaker = model.make_speaker_embedding(wav, sr)
1521+
1522+
cond = make_cond_dict(text="Hello, world!", speaker=speaker, language="en-us")
1523+
codes = model.generate(model.prepare_conditioning(cond))
1524+
1525+
audio = model.autoencoder.decode(codes)[0].cpu()
1526+
torchaudio.save("sample.wav", audio, model.autoencoder.sampling_rate)
1527+
`,
1528+
];
15101529
//#endregion

packages/tasks/src/model-libraries.ts

+8
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,14 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
10241024
countDownloads: `path_extension:"pt" OR path_extension:"safetensors"`,
10251025
snippets: snippets.ultralytics,
10261026
},
1027+
zonos: {
1028+
prettyLabel: "Zonos",
1029+
repoName: "Zonos",
1030+
repoUrl: "https://github.com/Zyphra/Zonos",
1031+
docsUrl: "https://github.com/Zyphra/Zonos",
1032+
snippets: snippets.zonos,
1033+
filter: false,
1034+
},
10271035
"3dtopia-xl": {
10281036
prettyLabel: "3DTopia-XL",
10291037
repoName: "3DTopia-XL",

0 commit comments

Comments
 (0)