Skip to content

Add Zonos snippet #1363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions packages/tasks/src/model-libraries-snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1376,4 +1376,22 @@ export const hezar = (model: ModelData): string[] => [

model = Model.load("${model.id}")`,
];

export const zonos = (model: ModelData): string[] => [
`import torchaudio
from zonos.model import Zonos
from zonos.conditioning import make_cond_dict

model = Zonos.from_pretrained("${model.id}", device="cuda")

wav, sr = torchaudio.load("speaker.wav") # 5-10s reference clip
speaker = model.make_speaker_embedding(wav, sr)

cond = make_cond_dict(text="Hello, world!", speaker=speaker, language="en-us")
codes = model.generate(model.prepare_conditioning(cond))

audio = model.autoencoder.decode(codes)[0].cpu()
torchaudio.save("sample.wav", audio, model.autoencoder.sampling_rate)
`,
];
//#endregion
9 changes: 9 additions & 0 deletions packages/tasks/src/model-libraries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,15 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
countDownloads: `path_extension:"pt" OR path_extension:"safetensors"`,
snippets: snippets.ultralytics,
},
zonos: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you tag all Zonos models with library_name: zonos in the model card metadata so that https://huggingface.co/models?other=zonos is populated?

If you don't own the repos yourself, you can always open PRs to let the authors know.

prettyLabel: "Zonos",
repoName: "Zonos",
repoUrl: "https://github.com/Zyphra/Zonos",
docsUrl: "https://github.com/Zyphra/Zonos",
snippets: snippets.zonos,
filter: false,
countDownloads: `path:"model.safetensors"`,
},
"3dtopia-xl": {
prettyLabel: "3DTopia-XL",
repoName: "3DTopia-XL",
Expand Down
Loading