From 29f608282ad47efe11e373c061a9acfe30571384 Mon Sep 17 00:00:00 2001 From: yanxing Date: Wed, 16 Jul 2025 15:04:13 +0800 Subject: [PATCH] [local-apps] add MNN to local-apps. --- packages/tasks/src/local-apps.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/packages/tasks/src/local-apps.ts b/packages/tasks/src/local-apps.ts index 53f6880282..867d3d6cc5 100644 --- a/packages/tasks/src/local-apps.ts +++ b/packages/tasks/src/local-apps.ts @@ -94,6 +94,10 @@ function isMlxModel(model: ModelData) { return model.tags.includes("mlx"); } +function isMNNModel(model: ModelData) { + return model.tags.includes("mnn"); +} + function getQuantTag(filepath?: string): string { const defaultTag = ":{{QUANT_TAG}}"; @@ -301,6 +305,22 @@ const snippetDockerModelRunner = (model: ModelData, filepath?: string): string = return `docker model run hf.co/${model.id}${getQuantTag(filepath)}`; }; +const snippetMNN = (model: ModelData, filepath?: string): LocalAppSnippet[] => { + return [ + { + title: "Build from source code", + setup: [ + "git clone https://github.com/alibaba/MNN.git", + "cd MNN", + "cmake -B build", + "cmake --build build -j -DMNN_LOW_MEMORY=ON -DMNN_CPU_WEIGHT_DEQUANT_GEMM=ON -DMNN_BUILD_LLM=ON -DMNN_SUPPORT_TRANSFORMER_FUSE=ON", + ].join("\n"), + content: `./build/llm_demo ${model.id}`, + }, + ]; +}; + + /** * Add your new local app here. * @@ -478,6 +498,13 @@ export const LOCAL_APPS = { displayOnModelPage: isLlamaCppGgufModel, snippet: snippetDockerModelRunner, }, + "MNN": { + prettyLabel: "MNN", + docsUrl: "https://github.com/alibaba/MNN", + mainTask: "text-generation", + displayOnModelPage: isMNNModel, + snippet: snippetMNN, + }, } satisfies Record; export type LocalAppKey = keyof typeof LOCAL_APPS;