From ca9151b58878b1b6d591e0c41f6dc62b310c11e6 Mon Sep 17 00:00:00 2001 From: Lain Date: Thu, 30 Jan 2025 18:35:28 +0100 Subject: [PATCH 1/3] add SwarmFormer --- packages/tasks/src/model-libraries-snippets.ts | 6 ++++++ packages/tasks/src/model-libraries.ts | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/packages/tasks/src/model-libraries-snippets.ts b/packages/tasks/src/model-libraries-snippets.ts index 991e2962dc..ee1665a618 100644 --- a/packages/tasks/src/model-libraries-snippets.ts +++ b/packages/tasks/src/model-libraries-snippets.ts @@ -1183,6 +1183,12 @@ from models.birefnet import BiRefNet model = BiRefNet.from_pretrained("${model.id}")`, ]; +export const swarmformer = (model: ModelData): string[] => [ + `from swarmformer import SwarmFormerModel +model = SwarmFormerModel.from_pretrained("${model.id}", trust_remote_code=True) +`, +]; + export const mlx = (model: ModelData): string[] => [ `pip install huggingface_hub hf_transfer diff --git a/packages/tasks/src/model-libraries.ts b/packages/tasks/src/model-libraries.ts index cef51ecf36..43a2091497 100644 --- a/packages/tasks/src/model-libraries.ts +++ b/packages/tasks/src/model-libraries.ts @@ -752,6 +752,13 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = { filter: true, countDownloads: `path:"models/default.zip"`, }, + swarmformer: { + prettyLabel: "SwarmFormer", + repoName: "SwarmFormer", + repoUrl: "https://github.com/takara-ai/SwarmFormer", + snippets: snippets.swarmformer, + filter: false, + }, "f5-tts": { prettyLabel: "F5-TTS", repoName: "F5-TTS", From 4fc907d20d8eb65bfe536734c1b4ff0671c6bac0 Mon Sep 17 00:00:00 2001 From: Lain Date: Thu, 30 Jan 2025 22:51:19 +0100 Subject: [PATCH 2/3] update mlx snippet --- packages/tasks/src/model-libraries-snippets.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tasks/src/model-libraries-snippets.ts b/packages/tasks/src/model-libraries-snippets.ts index ee1665a618..c4805d68fe 100644 --- a/packages/tasks/src/model-libraries-snippets.ts +++ b/packages/tasks/src/model-libraries-snippets.ts @@ -1192,7 +1192,7 @@ model = SwarmFormerModel.from_pretrained("${model.id}", trust_remote_code=True) export const mlx = (model: ModelData): string[] => [ `pip install huggingface_hub hf_transfer -export HF_HUB_ENABLE_HF_TRANS: string[]FER=1 +export HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download --local-dir ${nameWithoutNamespace(model.id)} ${model.id}`, ]; From 76891d34212a90fedcf47ab76c9fed5f939ece37 Mon Sep 17 00:00:00 2001 From: Lucain Date: Fri, 31 Jan 2025 09:38:32 +0100 Subject: [PATCH 3/3] Update packages/tasks/src/model-libraries-snippets.ts --- packages/tasks/src/model-libraries-snippets.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/tasks/src/model-libraries-snippets.ts b/packages/tasks/src/model-libraries-snippets.ts index c4805d68fe..07d2d7d2df 100644 --- a/packages/tasks/src/model-libraries-snippets.ts +++ b/packages/tasks/src/model-libraries-snippets.ts @@ -1185,6 +1185,7 @@ model = BiRefNet.from_pretrained("${model.id}")`, export const swarmformer = (model: ModelData): string[] => [ `from swarmformer import SwarmFormerModel + model = SwarmFormerModel.from_pretrained("${model.id}", trust_remote_code=True) `, ];