Skip to content

Commit 6c9b5da

Browse files
committed
snippetOllama with filepath specified
1 parent 5d00eb0 commit 6c9b5da

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/tasks/src/local-apps.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { ModelData } from "./model-data";
22
import type { PipelineType } from "./pipelines";
3+
import { parseGGUFQuantLabel } from "@huggingface/gguf";
34

45
export interface LocalAppSnippet {
56
/**
@@ -126,10 +127,15 @@ const snippetLlamacpp = (model: ModelData, filepath?: string): LocalAppSnippet[]
126127
];
127128
};
128129

129-
const snippetOllama = (model: ModelData, ollamatag?: string): string => {
130-
return `ollama run hf.co/${model.id}${ollamatag ?? "{{OLLAMA_TAG}}"}`;
130+
const snippetOllama = (model: ModelData, filepath?: string): string => {
131+
if (filepath) {
132+
const quantLabel = parseGGUFQuantLabel(filepath);
133+
const ollamatag = quantLabel ? `:${quantLabel}` : "";
134+
return `ollama run hf.co/${model.id}${ollamatag}`;
135+
}
136+
return `ollama run hf.co/${model.id}{{OLLAMA_TAG}}`;
131137
};
132-
``
138+
133139
const snippetLocalAI = (model: ModelData, filepath?: string): LocalAppSnippet[] => {
134140
const command = (binary: string) =>
135141
["# Load and run the model:", `${binary} huggingface://${model.id}/${filepath ?? "{{GGUF_FILE}}"}`].join("\n");

0 commit comments

Comments
 (0)