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.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
feat(config): enable partial model loading by default (#9092)
Alexander Eichhornfcf3aca5f787
diff --git a/docs/src/content/docs/configuration/low-vram-mode.mdx b/docs/src/content/docs/configuration/low-vram-mode.mdxindex be6e2a69e7..fa15cef873 100644--- a/docs/src/content/docs/configuration/low-vram-mode.mdx+++ b/docs/src/content/docs/configuration/low-vram-mode.mdx@@ -10,16 +10,18 @@ This allows you to generate even if your GPU doesn't have enough VRAM to hold fu## Enabling Low-VRAM mode-To enable Low-VRAM mode, add this line to your `invokeai.yaml` configuration file, then restart Invoke:--```yaml-enable_partial_loading: true-```+Low-VRAM mode is **enabled by default** via the `enable_partial_loading: true` setting in `invokeai.yaml`. No action is required to turn it on.**Windows users should also [disable the Nvidia sysmem fallback](#disabling-nvidia-sysmem-fallback-windows-only)**.It is possible to fine-tune the settings for best performance or if you still get out-of-memory errors (OOMs).+If you want to disable partial loading (e.g. on systems with plenty of VRAM where full loading is faster), add this line to your `invokeai.yaml` and restart Invoke:++```yaml+enable_partial_loading: false+```+:::tip[How to find `invokeai.yaml`]The `invokeai.yaml` configuration file lives in your install directory. To access it, run the **Invoke Community Edition** launcher and click the install location. This will open your install directory in a file explorer window.@@ -48,12 +50,14 @@ When an operation needs layers that are not in VRAM, but there isn't enough room#### Enabling partial model loading-As described above, you can enable partial model loading by adding this line to `invokeai.yaml`:+Partial model loading is enabled by default. The corresponding setting in `invokeai.yaml` is:```yamlenable_partial_loading: true```+Set it to `false` to disable partial loading.+### PyTorch CUDA allocator configThe PyTorch CUDA allocator's behavior can be configured using the `pytorch_cuda_alloc_conf` config. Tuning the allocator configuration can help to reduce the peak reserved VRAM. The optimal configuration is dependent on many factors (e.g. device type, VRAM, CUDA driver version, etc.), but switching from PyTorch's native allocator to using CUDA's built-in allocator works well on many systems. To try this, add the following line to your `invokeai.yaml` file:diff --git a/docs/src/generated/settings.json b/docs/src/generated/settings.jsonindex 99bb5f2f17..b25f824d95 100644--- a/docs/src/generated/settings.json+++ b/docs/src/generated/settings.json@@ -399,7 +399,7 @@},{"category": "CACHE",- "default": false,+ "default": true,"description": "Enable partial loading of models. This enables models to run with reduced VRAM requirements (at the cost of slower speed) by streaming the model from RAM to VRAM as its used. In some edge cases, partial loading can cause models to run more slowly if they were previously being fully loaded into VRAM.","env_var": "INVOKEAI_ENABLE_PARTIAL_LOADING","literal_values": [],diff --git a/invokeai/app/services/config/config_default.py b/invokeai/app/services/config/config_default.pyindex f11a8d7509..f8478ad64e 100644--- a/invokeai/app/services/config/config_default.py+++ b/invokeai/app/services/config/config_default.py@@ -186,7 +186,7 @@ class InvokeAIAppConfig(BaseSettings):log_memory_usage: bool = Field(default=False, description="If True, a memory snapshot will be captured before and after every model cache operation, and the result will be logged (at debug level). There is a time cost to capturing the memory snapshots, so it is recommended to only enable this feature if you are actively inspecting the model cache's behaviour.")model_cache_keep_alive_min: float = Field(default=0, ge=0, description="How long to keep models in cache after last use, in minutes. A value of 0 (the default) means models are kept in cache indefinitely. If no model generations occur within the timeout period, the model cache is cleared using the same logic as the 'Clear Model Cache' button.")device_working_mem_gb: float = Field(default=3, description="The amount of working memory to keep available on the compute device (in GB). Has no effect if running on CPU. If you are experiencing OOM errors, try increasing this value.")- enable_partial_loading: bool = Field(default=False, description="Enable partial loading of models. This enables models to run with reduced VRAM requirements (at the cost of slower speed) by streaming the model from RAM to VRAM as its used. In some edge cases, partial loading can cause models to run more slowly if they were previously being fully loaded into VRAM.")+ enable_partial_loading: bool = Field(default=True, description="Enable partial loading of models. This enables models to run with reduced VRAM requirements (at the cost of slower speed) by streaming the model from RAM to VRAM as its used. In some edge cases, partial loading can cause models to run more slowly if they were previously being fully loaded into VRAM.")keep_ram_copy_of_weights: bool = Field(default=True, description="Whether to keep a full RAM copy of a model's weights when the model is loaded in VRAM. Keeping a RAM copy increases average RAM usage, but speeds up model switching and LoRA patching (assuming there is sufficient RAM). Set this to False if RAM pressure is consistently high.")# Deprecated CACHE configsram: Optional[float] = Field(default=None, gt=0, description="DEPRECATED: This setting is no longer used. It has been replaced by `max_cache_ram_gb`, but most users will not need to use this config since automatic cache size limits should work well in most cases. This config setting will be removed once the new model cache behavior is stable.")diff --git a/invokeai/frontend/web/src/services/api/schema.ts b/invokeai/frontend/web/src/services/api/schema.tsindex 182ae210e2..c726173793 100644--- a/invokeai/frontend/web/src/services/api/schema.ts+++ b/invokeai/frontend/web/src/services/api/schema.ts@@ -16420,7 +16420,7 @@ export type components = {/*** Enable Partial Loading* @description Enable partial loading of models. This enables models to run with reduced VRAM requirements (at the cost of slower speed) by streaming the model from RAM to VRAM as its used. In some edge cases, partial loading can cause models to run more slowly if they were previously being fully loaded into VRAM.- * @default false+ * @default true*/enable_partial_loading?: boolean;/**