VRAM Cleanup (unload + empty cache):
The IAMCCS_VRAMCleanup node is designed to optimize the usage of VRAM (Video Random Access Memory) by managing and cleaning up resources that are no longer needed. This node is particularly useful in scenarios where VRAM is a limiting factor, such as in AI art generation or other GPU-intensive tasks. By efficiently unloading models and clearing caches, it helps prevent out-of-memory errors and ensures smoother operation of GPU resources. The node provides a mechanism to either unload all models or perform a soft cache cleanup, allowing for flexibility based on the user's needs. This functionality is crucial for maintaining performance and stability in environments with constrained VRAM availability.
VRAM Cleanup (unload + empty cache) Input Parameters:
unload_all_models
This parameter determines whether all models should be unloaded from VRAM. When set to True, it ensures that all models currently loaded into VRAM are removed, freeing up maximum memory space. This is particularly useful when you need to reset the VRAM state or prepare for a new task that requires significant memory. The default value is True, and it is a boolean parameter, meaning it can only be set to True or False.
soft_empty_cache
This parameter controls whether a soft cleanup of the VRAM cache should be performed. A soft cleanup attempts to free up memory by clearing cached data that is not actively in use, without unloading all models. This can help improve performance by making more VRAM available while retaining some data for quicker access if needed again. The default value is True, and like unload_all_models, it is a boolean parameter.
model
This optional parameter allows you to specify a particular model to be managed during the cleanup process. If provided, the node will consider this model in its operations, potentially retaining it in VRAM if unload_all_models is set to False. This parameter is useful when you want to selectively manage VRAM resources without affecting specific models.
clip
Similar to the model parameter, this optional parameter allows you to specify a CLIP model to be managed during the cleanup process. It provides flexibility in handling VRAM resources by allowing you to retain certain models while performing cleanup operations.
vae
This optional parameter allows you to specify a VAE (Variational Autoencoder) model to be managed during the cleanup process. It functions similarly to the model and clip parameters, offering selective control over which models are affected by the cleanup operations.
VRAM Cleanup (unload + empty cache) Output Parameters:
model
The model output parameter returns the model that was managed during the cleanup process. If a specific model was provided as an input, it will be returned here, allowing you to continue using it in subsequent operations.
clip
The clip output parameter returns the CLIP model that was managed during the cleanup process. This output is useful for maintaining continuity in workflows that involve CLIP models, ensuring that they remain available for further processing.
vae
The vae output parameter returns the VAE model that was managed during the cleanup process. This output ensures that VAE models remain accessible for subsequent tasks, providing a seamless transition between operations.
VRAM Cleanup (unload + empty cache) Usage Tips:
- Use
unload_all_modelsset toTruewhen you need to completely reset the VRAM state, especially before starting a new task that requires significant memory resources. - Set
soft_empty_cachetoTrueto perform a gentle cleanup of VRAM, which can help improve performance without fully unloading all models, making it ideal for ongoing tasks that require some memory optimization. - Specify particular models using the
model,clip, andvaeparameters to selectively manage VRAM resources, allowing you to retain important models while freeing up unnecessary memory.
VRAM Cleanup (unload + empty cache) Common Errors and Solutions:
VRAM Out of Memory
- Explanation: This error occurs when there is insufficient VRAM available to load or process the required models or data.
- Solution: Use the
IAMCCS_VRAMCleanupnode withunload_all_modelsset toTrueto free up VRAM, and ensure that unnecessary models are not loaded simultaneously.
Model Not Found
- Explanation: This error may occur if a specified model is not available or has been unloaded unexpectedly.
- Solution: Verify that the model is correctly specified in the input parameters and ensure it is loaded before performing operations that require it.
Unexpected Behavior After Cleanup
- Explanation: This can happen if essential models are unloaded during the cleanup process, affecting subsequent operations.
- Solution: Use the optional
model,clip, andvaeparameters to retain specific models during cleanup, ensuring they remain available for future tasks.
