From 3fa50052be4691b2d4163bbaeed49a0fbd438980 Mon Sep 17 00:00:00 2001 From: Lain Date: Mon, 26 Aug 2024 03:48:33 +0100 Subject: [PATCH 1/3] add gguf snippet for llamafile --- packages/tasks/src/local-apps.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/packages/tasks/src/local-apps.ts b/packages/tasks/src/local-apps.ts index 6b672c8fc..3af9f9afa 100644 --- a/packages/tasks/src/local-apps.ts +++ b/packages/tasks/src/local-apps.ts @@ -104,6 +104,29 @@ const snippetLlamacpp = (model: ModelData, filepath?: string): LocalAppSnippet[] ]; }; +const snippetLlamafileGGUF = (model: ModelData, filepath?: string): LocalAppSnippet[] => { + const command = (binary: string) => + [ + "# Load and run your model", + `wget https://huggingface.co/${model.id}/resolve/main/`.concat(`${filepath ?? "{{GGUF_FILE}}"}`), // could not figure out how to do it organically + `chmod +x ${binary}`, + `${binary} -m ${filepath?? "{{GGUF_FILE}}"} -p 'You are a helpful assistant' `, // will this create a second dropdown ? + ].join("\n"); + return [ + { + title: "Use pre-built binary", + setup: [ + // prettier-ignore + "# Download pre-built binary from:", + "# https://github.com/Mozilla-Ocho/llamafile/releases", + "# Example : ", + "# wget https://github.com/Mozilla-Ocho/llamafile/releases/download/0.8.13/llamafile-0.8.13", + ].join("\n"), + content: command("./llamafile-0.8.13") + } + ]; +}; + const snippetLocalAI = (model: ModelData, filepath?: string): LocalAppSnippet[] => { const command = (binary: string) => ["# Load and run the model:", `${binary} huggingface://${model.id}/${filepath ?? "{{GGUF_FILE}}"}`].join("\n"); @@ -146,6 +169,15 @@ export const LOCAL_APPS = { displayOnModelPage: isLlamaCppGgufModel, snippet: snippetLlamacpp, }, + // llamafile uses .llamafile and .gguf files + // update this later to handle .llamafile + llamafile : { + prettyLabel : "llamafile", + docsUrl : "https://github.com/Mozilla-Ocho/llamafile", + mainTask : "text-generation", + displayOnModelPage : isLlamaCppGgufModel, // update this later to include .llamafile + snippet: snippetLlamafileGGUF , + }, lmstudio: { prettyLabel: "LM Studio", docsUrl: "https://lmstudio.ai", From 321cb48a98bfd3fb8b6765d885a7140bb2f749f9 Mon Sep 17 00:00:00 2001 From: Lain Date: Mon, 26 Aug 2024 03:54:14 +0100 Subject: [PATCH 2/3] update comment --- packages/tasks/src/local-apps.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tasks/src/local-apps.ts b/packages/tasks/src/local-apps.ts index 3af9f9afa..610f099bc 100644 --- a/packages/tasks/src/local-apps.ts +++ b/packages/tasks/src/local-apps.ts @@ -108,7 +108,7 @@ const snippetLlamafileGGUF = (model: ModelData, filepath?: string): LocalAppSnip const command = (binary: string) => [ "# Load and run your model", - `wget https://huggingface.co/${model.id}/resolve/main/`.concat(`${filepath ?? "{{GGUF_FILE}}"}`), // could not figure out how to do it organically + `wget https://huggingface.co/${model.id}/resolve/main/`.concat(`${filepath ?? "{{GGUF_FILE}}"}`), // could not figure out how to do it without concat `chmod +x ${binary}`, `${binary} -m ${filepath?? "{{GGUF_FILE}}"} -p 'You are a helpful assistant' `, // will this create a second dropdown ? ].join("\n"); From 1ca85cdede97b15822452faa5912d2abaaa40bb1 Mon Sep 17 00:00:00 2001 From: Lain Date: Mon, 26 Aug 2024 04:30:35 +0100 Subject: [PATCH 3/3] =?UTF-8?q?update=20code=20snippet=20for=20?= =?UTF-8?q?=F0=9F=A6=99=F0=9F=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/tasks/src/local-apps.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tasks/src/local-apps.ts b/packages/tasks/src/local-apps.ts index 610f099bc..cbba85895 100644 --- a/packages/tasks/src/local-apps.ts +++ b/packages/tasks/src/local-apps.ts @@ -107,7 +107,7 @@ const snippetLlamacpp = (model: ModelData, filepath?: string): LocalAppSnippet[] const snippetLlamafileGGUF = (model: ModelData, filepath?: string): LocalAppSnippet[] => { const command = (binary: string) => [ - "# Load and run your model", + "# Load and run the model :", `wget https://huggingface.co/${model.id}/resolve/main/`.concat(`${filepath ?? "{{GGUF_FILE}}"}`), // could not figure out how to do it without concat `chmod +x ${binary}`, `${binary} -m ${filepath?? "{{GGUF_FILE}}"} -p 'You are a helpful assistant' `, // will this create a second dropdown ?