Merge pull request #2793 from luisgreen/dev
[#2791] - Proposal for addin use_mmap parameter
This commit is contained in:
commit
35b9cbcb29
8 changed files with 13 additions and 0 deletions
|
|
@ -735,6 +735,7 @@ declare global {
|
|||
stop?: string[];
|
||||
maxTokens?: number;
|
||||
numThreads?: number;
|
||||
useMmap?: boolean;
|
||||
keepAlive?: number;
|
||||
raw?: boolean;
|
||||
stream?: boolean;
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ const modelDescriptionSchema = z.object({
|
|||
stop: z.array(z.string()).optional(),
|
||||
maxTokens: z.number().optional(),
|
||||
numThreads: z.number().optional(),
|
||||
useMmap: z.boolean().optional(),
|
||||
keepAlive: z.number().optional(),
|
||||
raw: z.boolean().optional(),
|
||||
stream: z.boolean().optional(),
|
||||
|
|
|
|||
1
core/index.d.ts
vendored
1
core/index.d.ts
vendored
|
|
@ -803,6 +803,7 @@ interface BaseCompletionOptions {
|
|||
stop?: string[];
|
||||
maxTokens?: number;
|
||||
numThreads?: number;
|
||||
useMmap?: boolean;
|
||||
keepAlive?: number;
|
||||
raw?: boolean;
|
||||
stream?: boolean;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ interface ModelFileParams {
|
|||
min_p?: number;
|
||||
// deprecated?
|
||||
num_thread?: number;
|
||||
use_mmap?: boolean;
|
||||
num_gqa?: number;
|
||||
num_gpu?: number;
|
||||
}
|
||||
|
|
@ -191,6 +192,7 @@ class Ollama extends BaseLLM {
|
|||
num_ctx: this.contextLength,
|
||||
mirostat: options.mirostat,
|
||||
num_thread: options.numThreads,
|
||||
use_mmap: options.useMmap,
|
||||
min_p: options.minP,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ In addition to the model type, you can also configure some of the parameters tha
|
|||
- top_k: options.topK - This parameter limits the number of unique tokens to consider when generating the next token in the sequence. Higher values increase the variety of generated sequences, while lower values lead to more focused outputs.
|
||||
- num_predict: options.maxTokens - This determines the maximum number of tokens (words or characters) to generate for the given input prompt.
|
||||
- num_thread: options.numThreads - This is the multi-threading configuration option that controls how many threads the model uses for parallel processing. Higher values may lead to faster generation times but could also increase memory usage and complexity. Set this to one or two lower than the number of threads your CPU can handle to leave some for your GUI when running the model locally.
|
||||
- use_mmap: options.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.
|
||||
|
||||
## Authentication
|
||||
|
||||
|
|
|
|||
|
|
@ -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).
|
||||
- `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
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,11 @@
|
|||
"description": "The number of threads used in the generation process. Only available for Ollama (this is the num_thread parameter)",
|
||||
"type": "integer"
|
||||
},
|
||||
"useMmap": {
|
||||
"title": "Use Memory Map",
|
||||
"description": "Allows the model to be mapped into memory. If disabled can enhance response time on low end devices. Only available for Ollama (this is the use_mmap parameter)",
|
||||
"type": "boolean"
|
||||
},
|
||||
"keepAlive": {
|
||||
"title": "Ollama keep_alive",
|
||||
"description": "The number of seconds after no requests are made to unload the model from memory. Defaults to 60*30 = 30min",
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ export const completionOptionsSchema = z.object({
|
|||
stop: z.array(z.string()).optional(),
|
||||
maxTokens: z.number().optional(),
|
||||
numThreads: z.number().optional(),
|
||||
useMmap: z.boolean().optional(),
|
||||
keepAlive: z.number().optional(),
|
||||
raw: z.boolean().optional(),
|
||||
stream: z.boolean().optional(),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue