Merge pull request #4353 from Fmstrat/ollama-num-gpu
add support for Ollama num_gpu
This commit is contained in:
commit
ffd0e9c3c0
8 changed files with 12 additions and 1 deletions
|
|
@ -931,6 +931,7 @@ declare global {
|
|||
numThreads?: number;
|
||||
useMmap?: boolean;
|
||||
keepAlive?: number;
|
||||
numGpu?: number;
|
||||
raw?: boolean;
|
||||
stream?: boolean;
|
||||
prediction?: Prediction;
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ const modelDescriptionSchema = z.object({
|
|||
numThreads: z.number().optional(),
|
||||
useMmap: z.boolean().optional(),
|
||||
keepAlive: z.number().optional(),
|
||||
numGpu: z.number().optional(),
|
||||
raw: z.boolean().optional(),
|
||||
stream: z.boolean().optional(),
|
||||
})
|
||||
|
|
|
|||
1
core/index.d.ts
vendored
1
core/index.d.ts
vendored
|
|
@ -1021,6 +1021,7 @@ export interface BaseCompletionOptions {
|
|||
numThreads?: number;
|
||||
useMmap?: boolean;
|
||||
keepAlive?: number;
|
||||
numGpu?: number;
|
||||
raw?: boolean;
|
||||
stream?: boolean;
|
||||
prediction?: Prediction;
|
||||
|
|
|
|||
|
|
@ -41,12 +41,12 @@ interface OllamaModelFileParams {
|
|||
top_k?: number;
|
||||
top_p?: number;
|
||||
min_p?: number;
|
||||
num_gpu?: number;
|
||||
|
||||
// deprecated or not directly supported here:
|
||||
num_thread?: number;
|
||||
use_mmap?: boolean;
|
||||
num_gqa?: number;
|
||||
num_gpu?: number;
|
||||
num_keep?: number;
|
||||
typical_p?: number;
|
||||
presence_penalty?: number;
|
||||
|
|
@ -280,6 +280,7 @@ class Ollama extends BaseLLM implements ModelInstaller {
|
|||
num_thread: options.numThreads,
|
||||
use_mmap: options.useMmap,
|
||||
min_p: options.minP,
|
||||
num_gpu: options.numGpu,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ Parameters that control the behavior of text generation and completion settings.
|
|||
- `maxTokens`: The maximum number of tokens to generate in a completion (default: `2048`).
|
||||
- `numThreads`: The number of threads used during the generation process. Available only for Ollama as `num_thread`.
|
||||
- `keepAlive`: For Ollama, this parameter sets the number of seconds to keep the model loaded after the last request, unloading it from memory if inactive (default: `1800` seconds, or 30 minutes).
|
||||
- `numGpu`: For Ollama, this parameter overrides the number of gpu layers that will be used to load the model into VRAM.
|
||||
- `useMmap`: For Ollama, this parameter allows the model to be mapped into memory. If disabled can enhance response time on low end devices but will slow down the stream.
|
||||
- `reasoning`: Enables thinking/reasoning for Anthropic Claude 3.7+ models.
|
||||
- `reasoningBudgetTokens`: Sets budget tokens for thinking/reasoning in Anthropic Claude 3.7+ models.
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@ Parameters that control the behavior of text generation and completion settings.
|
|||
- `maxTokens`: The maximum number of tokens to generate in a completion (default: `2048`).
|
||||
- `numThreads`: The number of threads used during the generation process. Available only for Ollama as `num_thread`.
|
||||
- `keepAlive`: For Ollama, this parameter sets the number of seconds to keep the model loaded after the last request, unloading it from memory if inactive (default: `1800` seconds, or 30 minutes).
|
||||
- `numGpu`: For Ollama, this parameter overrides the number of gpu layers that will be used to load the model into VRAM.
|
||||
- `useMmap`: For Ollama, this parameter allows the model to be mapped into memory. If disabled can enhance response time on low end devices but will slow down the stream.
|
||||
|
||||
Example
|
||||
|
|
|
|||
|
|
@ -72,6 +72,10 @@
|
|||
"description": "The number of seconds after no requests are made to unload the model from memory. Defaults to 60*30 = 30min",
|
||||
"type": "integer"
|
||||
},
|
||||
"numGpu": {
|
||||
"title": "Ollama num_gpu",
|
||||
"description": "Override the number of gpu layers used when loading the model"
|
||||
},
|
||||
"reasoning": {
|
||||
"title": "Reasoning",
|
||||
"description": "Enable thinking/reasoning for Anthropic Claude 3.7+ models",
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ export const completionOptionsSchema = z.object({
|
|||
numThreads: z.number().optional(),
|
||||
useMmap: z.boolean().optional(),
|
||||
keepAlive: z.number().optional(),
|
||||
numGpu: z.number().optional(),
|
||||
raw: z.boolean().optional(),
|
||||
stream: z.boolean().optional(),
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue