Skip to content

Commit

Permalink
local-apps: update llama.cpp snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
ngxson committed Jan 14, 2025
1 parent 529248a commit e0a8f36
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/tasks/src/local-apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,20 @@ function isMlxModel(model: ModelData) {
}

const snippetLlamacpp = (model: ModelData, filepath?: string): LocalAppSnippet[] => {
let tagName = "";
if (filepath) {
const quantLabel = parseGGUFQuantLabel(filepath);
tagName = quantLabel ? `:${quantLabel}` : "";
}
const command = (binary: string) => {
const snippet = [
"# Load and run the model:",
`${binary} \\`,
` --hf-repo "${model.id}" \\`,
` --hf-file ${filepath ?? "{{GGUF_FILE}}"} \\`,
` -p "${model.tags.includes("conversational") ? "You are a helpful assistant" : "Once upon a time,"}"`,
`${binary} -hf ${model.id}${tagName}`,
];
if (model.tags.includes("conversational")) {
if (!model.tags.includes("conversational")) {
// for non-conversational models, add a prompt
snippet[snippet.length - 1] += " \\";
snippet.push(" --conversation");
snippet.push(" -p \"Once upon a time,\"");
}
return snippet.join("\n");
};
Expand Down

0 comments on commit e0a8f36

Please sign in to comment.