From 334a78a0b42d0b755bf25d3e23b952ad02c6e77c Mon Sep 17 00:00:00 2001
From: Deep-Unlearning <steven@macbook-pro-de-steven.taildb5d.ts.net>
Date: Thu, 17 Apr 2025 14:28:38 +0200
Subject: [PATCH 1/7] Add Zonos snippet

---
 packages/tasks/src/model-libraries-snippets.ts | 18 ++++++++++++++++++
 packages/tasks/src/model-libraries.ts          |  9 +++++++++
 2 files changed, 27 insertions(+)

diff --git a/packages/tasks/src/model-libraries-snippets.ts b/packages/tasks/src/model-libraries-snippets.ts
index 42f18bfeaf..11cf9887f0 100644
--- a/packages/tasks/src/model-libraries-snippets.ts
+++ b/packages/tasks/src/model-libraries-snippets.ts
@@ -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
diff --git a/packages/tasks/src/model-libraries.ts b/packages/tasks/src/model-libraries.ts
index 3b7bc3aa65..f49dc7aa09 100644
--- a/packages/tasks/src/model-libraries.ts
+++ b/packages/tasks/src/model-libraries.ts
@@ -980,6 +980,15 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
 		countDownloads: `path_extension:"pt" OR path_extension:"safetensors"`,
 		snippets: snippets.ultralytics,
 	},
+	zonos: {
+		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",

From 71eb5db4819dcc753005ec45c9ec0910dc5064b9 Mon Sep 17 00:00:00 2001
From: Deep-Unlearning <steven@MacBook-Pro-de-Steven.local>
Date: Tue, 22 Apr 2025 11:58:46 +0200
Subject: [PATCH 2/7] Add IndexTTS snippet

---
 packages/tasks/src/model-libraries-snippets.ts | 17 +++++++++++++++++
 packages/tasks/src/model-libraries.ts          |  7 +++++++
 2 files changed, 24 insertions(+)

diff --git a/packages/tasks/src/model-libraries-snippets.ts b/packages/tasks/src/model-libraries-snippets.ts
index 11cf9887f0..c138fcbd99 100644
--- a/packages/tasks/src/model-libraries-snippets.ts
+++ b/packages/tasks/src/model-libraries-snippets.ts
@@ -424,6 +424,23 @@ export const gliner = (model: ModelData): string[] => [
 model = GLiNER.from_pretrained("${model.id}")`,
 ];
 
+export const indextts = (model: ModelData): string[] => [
+	`# Download model files from ${model.id} into a 'checkpoints' directory
+# e.g., using: huggingface-cli download ${model.id} \
+  bigvgan_discriminator.pth bigvgan_generator.pth bpe.model dvae.pth gpt.pth unigram_12000.vocab \
+  --local-dir checkpoints
+from indextts.infer import IndexTTS
+
+# Ensure config.yaml is present in the checkpoints directory
+tts = IndexTTS(model_dir="checkpoints", cfg_path="checkpoints/config.yaml")
+
+voice = "path/to/your/reference_voice.wav"  # Path to the voice reference audio file
+text = "Hello, how are you?"
+output_path = "output_index.wav"
+
+tts.infer(voice, text, output_path)`,
+];
+
 export const htrflow = (model: ModelData): string[] => [
 	`# CLI usage
 # see docs: https://ai-riksarkivet.github.io/htrflow/latest/getting_started/quick_start.html
diff --git a/packages/tasks/src/model-libraries.ts b/packages/tasks/src/model-libraries.ts
index f49dc7aa09..b2f2b8174a 100644
--- a/packages/tasks/src/model-libraries.ts
+++ b/packages/tasks/src/model-libraries.ts
@@ -419,6 +419,13 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
 		repoUrl: "https://github.com/DigitalPhonetics/IMS-Toucan",
 		countDownloads: `path:"embedding_gan.pt" OR path:"Vocoder.pt" OR path:"ToucanTTS.pt"`,
 	},
+	index_tts: {
+		prettyLabel: "IndexTTS",
+		repoName: "IndexTTS",
+		repoUrl: "https://github.com/index-tts/index-tts",
+		snippets: snippets.indextts,
+		filter: false,
+	},
 	"infinite-you": {
 		prettyLabel: "InfiniteYou",
 		repoName: "InfiniteYou",

From bd02b380d3f57a43a63b14bf2ae48e40bd4f6713 Mon Sep 17 00:00:00 2001
From: Deep-Unlearning <steven@MacBook-Pro-de-Steven.local>
Date: Tue, 22 Apr 2025 12:00:00 +0200
Subject: [PATCH 3/7] Remove Zonos snippet code

---
 packages/tasks/src/model-libraries-snippets.ts | 18 ------------------
 packages/tasks/src/model-libraries.ts          | 17 -----------------
 2 files changed, 35 deletions(-)

diff --git a/packages/tasks/src/model-libraries-snippets.ts b/packages/tasks/src/model-libraries-snippets.ts
index c138fcbd99..569435f00c 100644
--- a/packages/tasks/src/model-libraries-snippets.ts
+++ b/packages/tasks/src/model-libraries-snippets.ts
@@ -1393,22 +1393,4 @@ 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
diff --git a/packages/tasks/src/model-libraries.ts b/packages/tasks/src/model-libraries.ts
index b2f2b8174a..a5e675415c 100644
--- a/packages/tasks/src/model-libraries.ts
+++ b/packages/tasks/src/model-libraries.ts
@@ -987,23 +987,6 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
 		countDownloads: `path_extension:"pt" OR path_extension:"safetensors"`,
 		snippets: snippets.ultralytics,
 	},
-	zonos: {
-		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",
-		repoUrl: "https://github.com/3DTopia/3DTopia-XL",
-		filter: false,
-		countDownloads: `path:"model_vae_fp16.pt"`,
-		snippets: snippets.threedtopia_xl,
-	},
 } satisfies Record<string, LibraryUiElement>;
 
 export type ModelLibraryKey = keyof typeof MODEL_LIBRARIES_UI_ELEMENTS;

From 08d54d9bf6e946df893fedcc58de4abd4941bfca Mon Sep 17 00:00:00 2001
From: Deep-Unlearning <steven@MacBook-Pro-de-Steven.local>
Date: Tue, 22 Apr 2025 12:00:56 +0200
Subject: [PATCH 4/7] Remove Zonos snippet code

---
 packages/tasks/src/model-libraries.ts | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/packages/tasks/src/model-libraries.ts b/packages/tasks/src/model-libraries.ts
index a5e675415c..91e3a9b461 100644
--- a/packages/tasks/src/model-libraries.ts
+++ b/packages/tasks/src/model-libraries.ts
@@ -987,6 +987,14 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
 		countDownloads: `path_extension:"pt" OR path_extension:"safetensors"`,
 		snippets: snippets.ultralytics,
 	},
+	"3dtopia-xl": {
+		prettyLabel: "3DTopia-XL",
+		repoName: "3DTopia-XL",
+		repoUrl: "https://github.com/3DTopia/3DTopia-XL",
+		filter: false,
+		countDownloads: `path:"model_vae_fp16.pt"`,
+		snippets: snippets.threedtopia_xl,
+	},
 } satisfies Record<string, LibraryUiElement>;
 
 export type ModelLibraryKey = keyof typeof MODEL_LIBRARIES_UI_ELEMENTS;

From bbc6f69e7c35da3b547cb339b05db35c72d6c1ca Mon Sep 17 00:00:00 2001
From: Steven Zheng <58599908+Deep-unlearning@users.noreply.github.com>
Date: Thu, 24 Apr 2025 10:32:06 +0200
Subject: [PATCH 5/7] Update packages/tasks/src/model-libraries.ts

Co-authored-by: Lucain <lucain@huggingface.co>
---
 packages/tasks/src/model-libraries.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/packages/tasks/src/model-libraries.ts b/packages/tasks/src/model-libraries.ts
index 91e3a9b461..c0c9f8c638 100644
--- a/packages/tasks/src/model-libraries.ts
+++ b/packages/tasks/src/model-libraries.ts
@@ -419,7 +419,7 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
 		repoUrl: "https://github.com/DigitalPhonetics/IMS-Toucan",
 		countDownloads: `path:"embedding_gan.pt" OR path:"Vocoder.pt" OR path:"ToucanTTS.pt"`,
 	},
-	index_tts: {
+	index-tts: {
 		prettyLabel: "IndexTTS",
 		repoName: "IndexTTS",
 		repoUrl: "https://github.com/index-tts/index-tts",

From c9d7a3df628baf511c026983e8e5ef99f064f810 Mon Sep 17 00:00:00 2001
From: Steven Zheng <58599908+Deep-unlearning@users.noreply.github.com>
Date: Thu, 24 Apr 2025 10:32:18 +0200
Subject: [PATCH 6/7] Update packages/tasks/src/model-libraries-snippets.ts

Co-authored-by: Lucain <lucain@huggingface.co>
---
 packages/tasks/src/model-libraries-snippets.ts | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/packages/tasks/src/model-libraries-snippets.ts b/packages/tasks/src/model-libraries-snippets.ts
index 569435f00c..3e0a0c3163 100644
--- a/packages/tasks/src/model-libraries-snippets.ts
+++ b/packages/tasks/src/model-libraries-snippets.ts
@@ -425,10 +425,11 @@ model = GLiNER.from_pretrained("${model.id}")`,
 ];
 
 export const indextts = (model: ModelData): string[] => [
-	`# Download model files from ${model.id} into a 'checkpoints' directory
-# e.g., using: huggingface-cli download ${model.id} \
-  bigvgan_discriminator.pth bigvgan_generator.pth bpe.model dvae.pth gpt.pth unigram_12000.vocab \
-  --local-dir checkpoints
+	`# Download model
+from huggingface_hub import snapshot_download
+
+snapshot_download(${model.id}, local_dir="checkpoints")
+
 from indextts.infer import IndexTTS
 
 # Ensure config.yaml is present in the checkpoints directory

From edd99becb12d5a3fbecf2fc166538a7ffb1ea54e Mon Sep 17 00:00:00 2001
From: Lucain <lucain@huggingface.co>
Date: Fri, 25 Apr 2025 08:34:26 +0200
Subject: [PATCH 7/7] Update packages/tasks/src/model-libraries.ts

---
 packages/tasks/src/model-libraries.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/packages/tasks/src/model-libraries.ts b/packages/tasks/src/model-libraries.ts
index 68597b62e4..ba0d44ee0a 100644
--- a/packages/tasks/src/model-libraries.ts
+++ b/packages/tasks/src/model-libraries.ts
@@ -426,7 +426,7 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
 		repoUrl: "https://github.com/DigitalPhonetics/IMS-Toucan",
 		countDownloads: `path:"embedding_gan.pt" OR path:"Vocoder.pt" OR path:"ToucanTTS.pt"`,
 	},
-	index-tts: {
+	"index-tts": {
 		prettyLabel: "IndexTTS",
 		repoName: "IndexTTS",
 		repoUrl: "https://github.com/index-tts/index-tts",