A custom node for ComfyUI, ComfyUI-SaveMem enables users to save images and latent representations directly to shared memory, facilitating efficient data handling via API. This tool enhances interoperability within ComfyUI by allowing multiple images and latents to be stored and retrieved seamlessly.
- Supports saving multiple images in PNG format and latents in various shapes to shared memory.
- Utilizes
multiprocessing.shared_memory.SharedMemoryfor efficient memory management and data access. - Requires pre-creation of shared memory on the receiving end to ensure proper data handling.
Context
ComfyUI-SaveMem is designed as an extension for ComfyUI, focusing on the efficient storage of images and latent tensors in shared memory. Its primary goal is to enhance data exchange between different components of the ComfyUI ecosystem through the use of shared memory, which is particularly useful in multi-process environments.
Key Features & Benefits
The tool includes two main nodes: SaveImagesMemory and SaveLatentsMemory. SaveImagesMemory allows users to send multiple images as binary data in PNG format to a specified shared memory, while SaveLatentsMemory enables the saving of latent representations using PyTorch's serialization capabilities. Both nodes require a designated name for the shared memory, ensuring organized data management.
Advanced Functionalities
The SaveImagesMemory node is capable of handling multiple images simultaneously, which is beneficial for batch processing scenarios. The SaveLatentsMemory node supports latents of any shape, making it versatile for various AI models and applications. Users can also utilize an optional dummy input to trigger redraws, enhancing interactivity during the data handling process.
Practical Benefits
By implementing ComfyUI-SaveMem, users can significantly streamline their workflow, allowing for faster access to shared data across different processes. This tool improves control over data handling and enhances the overall efficiency of image and latent management in ComfyUI, ultimately leading to higher quality outputs and a smoother user experience.
Credits/Acknowledgments
The original authors and contributors of ComfyUI-SaveMem are acknowledged for their work in creating this valuable tool, which is available under an open-source license, promoting collaboration and further development within the community.