-
Notifications
You must be signed in to change notification settings - Fork 436
Add ollama #687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add ollama #687
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7d35685
Add ollama
boxabirds d84ea80
snippetOllama
mishig25 032fae2
update displayOnModelPage
mishig25 5d00eb0
docsUrl: "https://ollama.com",
mishig25 6c9b5da
snippetOllama with filepath specified
mishig25 6f4effe
Merge branch 'main' into patch-1
mishig25 00710be
Merge branch 'main' into patch-1
mishig25 acae236
dependencies @huggingface/gguf
mishig25 cbf44d6
displayOnModelPage: isLlamaCppGgufModel,
mishig25 b34e76b
pnpm add @huggingface/gguf@workspace:^
mishig25 c2691b0
comment "Support the placeholder {{OLLAMA_TAG}}"
mishig25 8887e64
Merge branch 'main' into patch-1
mishig25 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import type { ModelData } from "./model-data"; | ||
import type { PipelineType } from "./pipelines"; | ||
import { parseGGUFQuantLabel } from "@huggingface/gguf"; | ||
|
||
export interface LocalAppSnippet { | ||
/** | ||
|
@@ -53,6 +54,7 @@ export type LocalApp = { | |
/** | ||
* And if not (mostly llama.cpp), snippet to copy/paste in your terminal | ||
* Support the placeholder {{GGUF_FILE}} that will be replaced by the gguf file path or the list of available files. | ||
* Support the placeholder {{OLLAMA_TAG}} that will be replaced by the list of available quant tags or will be removed if there are no multiple quant files in a same repo. | ||
*/ | ||
snippet: (model: ModelData, filepath?: string) => string | string[] | LocalAppSnippet | LocalAppSnippet[]; | ||
} | ||
|
@@ -143,6 +145,15 @@ const snippetNodeLlamaCppCli = (model: ModelData, filepath?: string): LocalAppSn | |
]; | ||
}; | ||
|
||
const snippetOllama = (model: ModelData, filepath?: string): string => { | ||
if (filepath) { | ||
const quantLabel = parseGGUFQuantLabel(filepath); | ||
const ollamatag = quantLabel ? `:${quantLabel}` : ""; | ||
return `ollama run hf.co/${model.id}${ollamatag}`; | ||
} | ||
return `ollama run hf.co/${model.id}{{OLLAMA_TAG}}`; | ||
}; | ||
|
||
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"); | ||
|
@@ -389,6 +400,13 @@ export const LOCAL_APPS = { | |
displayOnModelPage: (model) => model.library_name === "diffusers" && model.pipeline_tag === "text-to-image", | ||
deeplink: (model) => new URL(`https://models.invoke.ai/huggingface/${model.id}`), | ||
}, | ||
ollama: { | ||
prettyLabel: "Ollama", | ||
docsUrl: "https://ollama.com", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably have dedicated docs on the hub for this, but we can make a follow-up PR later on |
||
mainTask: "text-generation", | ||
displayOnModelPage: isLlamaCppGgufModel, | ||
snippet: snippetOllama, | ||
}, | ||
} satisfies Record<string, LocalApp>; | ||
|
||
export type LocalAppKey = keyof typeof LOCAL_APPS; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.