Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

docs: document reserved VRAM setting

JPPhoto268d2fe46a69
diff --git a/docs/src/content/docs/configuration/Optimization/low-vram-mode.mdx b/docs/src/content/docs/configuration/Optimization/low-vram-mode.mdx
index 0626eb3107..125171a86b 100644
--- a/docs/src/content/docs/configuration/Optimization/low-vram-mode.mdx
+++ b/docs/src/content/docs/configuration/Optimization/low-vram-mode.mdx
@@ -37,6 +37,7 @@ Low-VRAM mode and related workload-specific optimizations include:
- Partial model loading (`enable_partial_loading`)
- PyTorch CUDA allocator config (`pytorch_cuda_alloc_conf`)
- Dynamic RAM and VRAM cache sizes (`max_cache_ram_gb`, `max_cache_vram_gb`)
+- Extra VRAM kept outside the model cache (`reserve_vram_gb`)
- Working memory (`device_working_mem_gb`)
- Keeping a RAM weight copy (`keep_ram_copy_of_weights`)
- Tiled VAE decode and encode (`auto_tiled_decode`, `force_tiled_decode`)
@@ -125,15 +126,27 @@ max_cache_vram_gb: 16
:::caution[Max safe value for `max_cache_vram_gb`]
Most users should not manually configure the `max_cache_vram_gb`. This configuration value caps model-cache residency; `device_working_mem_gb` and operation-specific reservations (e.g. VAE decode) are still subtracted from that cap for every model-cache operation, not only when Wan memory optimization is enabled. A cap below the active working-memory reservation can force aggressive model offloading.
- For users who wish to configure `max_cache_vram_gb`, the max safe value can be determined by subtracting `device_working_mem_gb` from your GPU's VRAM. As described below, the default for `device_working_mem_gb` is 3GB.
+ For users who wish to configure `max_cache_vram_gb`, estimate the max safe value by subtracting both `device_working_mem_gb` and `reserve_vram_gb` from your GPU's VRAM. The default for `device_working_mem_gb` is 3GB, and `reserve_vram_gb` defaults to 0GB.
- For example, if you have a 12GB GPU, the max safe value for `max_cache_vram_gb` is `12GB - 3GB = 9GB`.
+ For example, with a 12GB GPU and default settings, the max safe value is `12GB - 3GB - 0GB = 9GB`.
- If you had increased `device_working_mem_gb` to 4GB, then the max safe value for `max_cache_vram_gb` is `12GB - 4GB = 8GB`.
+ If you increase `device_working_mem_gb` to 4GB and set `reserve_vram_gb` to 1GB, the max safe value is `12GB - 4GB - 1GB = 7GB`.
Most users who override `max_cache_vram_gb` are doing so because they wish to use significantly less VRAM, and should be setting `max_cache_vram_gb` to a value significantly less than the 'max safe value'.
:::
+### Reserving VRAM outside the model cache
+
+`reserve_vram_gb` keeps the configured amount of VRAM unavailable to the model cache. This can leave room for other GPU workloads that are not managed by the cache. The default is `0`, so the option has no effect unless configured.
+
+For example, add this to `invokeai.yaml` to reserve 1GB:
+
+```yaml
+reserve_vram_gb: 1
+```
+
+This reserve is in addition to `device_working_mem_gb` and any operation-specific working-memory requests. A larger reserve can cause models to be offloaded or partially loaded sooner.
+
### Working memory
Invoke cannot use _all_ of your VRAM for model caching and loading. It requires some VRAM to use as working memory for various operations.
diff --git a/docs/src/generated/settings.json b/docs/src/generated/settings.json
index 2dcfa83781..947eafe779 100644
--- a/docs/src/generated/settings.json
+++ b/docs/src/generated/settings.json
@@ -482,6 +482,17 @@
"type": "typing.Optional[float]",
"validation": {}
},
+ {
+ "category": "CACHE",
+ "default": 0.0,
+ "description": "The amount of VRAM (in GB) to subtract from the model cache's available memory budget. Defaults to 0.",
+ "env_var": "INVOKEAI_RESERVE_VRAM_GB",
+ "literal_values": [],
+ "name": "reserve_vram_gb",
+ "required": false,
+ "type": "<class 'float'>",
+ "validation": {}
+ },
{
"category": "CACHE",
"default": false,