common: migrate the deprecated --mmap/--no-mmap to --load-mode (#26934)
Replace the deprecated --mmap, --no-mmap, --mlock, and --direct-io flags with the unified --load-mode argument across scripts, examples, and documentation. Internal warning message and env var docs updated accordingly. Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
This commit is contained in:
@@ -524,13 +524,15 @@ These options help improve the performance and memory usage of the LLaMA models.
|
||||
- `-t N, --threads N`: Set the number of threads to use during generation. For optimal performance, it is recommended to set this value to the number of physical CPU cores your system has (as opposed to the logical number of cores). Using the correct number of threads can greatly improve performance.
|
||||
- `-tb N, --threads-batch N`: Set the number of threads to use during batch and prompt processing. In some systems, it is beneficial to use a higher number of threads during batch processing than during generation. If not specified, the number of threads used for batch processing will be the same as the number of threads used for generation.
|
||||
|
||||
### Mlock
|
||||
### Model Loading Mode
|
||||
|
||||
- `--mlock`: Lock the model in memory, preventing it from being swapped out when memory-mapped. This can improve performance but trades away some of the advantages of memory-mapping by requiring more RAM to run and potentially slowing down load times as the model loads into RAM.
|
||||
|
||||
### No Memory Mapping
|
||||
|
||||
- `--no-mmap`: Do not memory-map the model. By default, models are mapped into memory, which allows the system to load only the necessary parts of the model as needed. However, if the model is larger than your total amount of RAM or if your system is low on available memory, using mmap might increase the risk of pageouts, negatively impacting performance. Disabling mmap results in slower load times but may reduce pageouts if you're not using `--mlock`. Note that if the model is larger than the total amount of RAM, turning off mmap would prevent the model from loading at all.
|
||||
- `-lm MODE, --load-mode MODE`: Specify the model loading mode (default: `auto`).
|
||||
- `auto`: Memory-map the model, unless the device does not support it.
|
||||
- `none`: No special loading mode. Disabling mmap results in slower load times but may reduce pageouts if you're not using `mlock`. Note that if the model is larger than the total amount of RAM, turning off mmap would prevent the model from loading at all.
|
||||
- `mmap`: Memory-map the model.
|
||||
- `mlock`: Lock the model in memory, preventing it from being swapped out when memory-mapped. This can improve performance but trades away some of the advantages of memory-mapping by requiring more RAM to run and potentially slowing down load times as the model loads into RAM.
|
||||
- `mmap+mlock`: Memory-map the model and lock it in memory.
|
||||
- `dio`: Use DirectIO if available.
|
||||
|
||||
### NUMA support
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ test parameters:
|
||||
-nkvo, --no-kv-offload <0|1> (default: 0)
|
||||
-fa, --flash-attn <on|off|auto> (default: auto)
|
||||
-dev, --device <dev0/dev1/...> (default: auto)
|
||||
-mmp, --mmap <0|1> (default: 1)
|
||||
-dio, --direct-io <0|1> (default: 0)
|
||||
-mmp, --mmap <0|1> (DEPRECATED IN FAVOUR OF --load-mode)
|
||||
-dio, --direct-io <0|1> (DEPRECATED IN FAVOUR OF --load-mode)
|
||||
-embd, --embeddings <0|1> (default: 0)
|
||||
-ts, --tensor-split <ts0/ts1/..> (default: 0)
|
||||
-ot --override-tensor <tensor name pattern>=<buffer type>;...
|
||||
|
||||
+12
-5
@@ -296,10 +296,17 @@ For the full list of features, please refer to [server's changelog](https://gith
|
||||
|
||||
Note: If both command line argument and environment variable are both set for the same param, the argument will take precedence over env var.
|
||||
|
||||
For boolean options like `--mmap` or `--kv-offload`, the environment variable is handled as shown in this example:
|
||||
- `LLAMA_ARG_MMAP=true` means enabled, other accepted values are: `1`, `on`, `enabled`
|
||||
- `LLAMA_ARG_MMAP=false` means disabled, other accepted values are: `0`, `off`, `disabled`
|
||||
- If `LLAMA_ARG_NO_MMAP` is present (no matter the value), it means disabling mmap
|
||||
For string options like `--load-mode`, the environment variable is handled as shown in this example:
|
||||
- `LLAMA_ARG_LOAD_MODE=auto` sets the loading mode to auto (default)
|
||||
- `LLAMA_ARG_LOAD_MODE=none` disables special loading
|
||||
- `LLAMA_ARG_LOAD_MODE=mmap` enables memory-mapping
|
||||
- `LLAMA_ARG_LOAD_MODE=mlock` locks the model in RAM
|
||||
- `LLAMA_ARG_LOAD_MODE=mmap+mlock` enables memory-mapping and locks in RAM
|
||||
- `LLAMA_ARG_LOAD_MODE=dio` uses DirectIO if available
|
||||
|
||||
For boolean options like `--kv-offload`:
|
||||
- `LLAMA_ARG_KV_OFFLOAD=true` means enabled, other accepted values are: `1`, `on`, `enabled`
|
||||
- `LLAMA_ARG_KV_OFFLOAD=false` means disabled, other accepted values are: `0`, `off`, `disabled`
|
||||
|
||||
Example usage of docker compose with environment variables:
|
||||
|
||||
@@ -1893,7 +1900,7 @@ Example events:
|
||||
}
|
||||
// note for "loading" status:
|
||||
// - subsequent events will follow the same order of "stages" list
|
||||
// - mmap is may report incorrect progress on some platforms; if you need exact progress, use --no-mmap
|
||||
// - mmap may report incorrect progress on some platforms; if you need exact progress, use --load-mode none
|
||||
|
||||
{
|
||||
"model": "...",
|
||||
|
||||
Reference in New Issue
Block a user