Pruna x ComfyUI

Getting Started with Pruna & ComfyUI

In this guide, we’ll walk you through integrating the pruna node into ComfyUI to supercharge your Stable Diffusion and Flux workflows. Step by step, you’ll learn how to harness advanced compilation techniques to achieve faster, more efficient image generation. For more details, visit our repository, where you’ll also find performance benchmarks and other helpful resources.

Step 1: Prerequisites

  1. Create a conda environment with Python 3.10

  2. Install ComfyUI

  3. Install pruna using pip

Step 2: Integrate the Pruna Node

To integrate the pruna node into ComfyUI, follow these steps:

  1. Navigate to your ComfyUI installation’s custom_nodes folder:

    cd <path_to_comfyui>/custom_nodes
    
  2. Clone the ComfyUI_pruna repository:

    git clone https://github.com/PrunaAI/ComfyUI_pruna.git
    
  3. Launch ComfyUI. For example:

    cd <path_to_comfyui> && python main.py --disable-cuda-malloc --gpu-only
    

After completing these steps, you should now see the Pruna Compile node in the nodes menu, under the pruna category.

Usage

Our node currently supports two compilation modes: x-fast and torch_compile. The default is x-fast.

We provide two ComfyUI workflows to help you get started with our Pruna node — one for Stable Diffusion and one for Flux.

You can load a workflow either by dragging and dropping the provided JSON file into the ComfyUI window, or by clicking Open in the Workflow tab, as shown here.

Example 1: Stable Diffusion

In this example, we will accelerate the inference of the Stable Diffusion v1.4 model.

First, download the model and place it in the appropriate folder:

  1. Download the model

  2. Place it in <path_to_comfyui>/models/checkpoints

Then, use the Stable Diffusion workflow, as described above, to generate images. Your workflow should resemble this.

Example 2: Flux

To use the Flux workflow, you need to download all the components of the model separately. More specifically:

1. For CLIP, download the clip_l.safetensors and t5xxl_fp16.safetensors files, and place them in <path_to_comfyui>/models/clip/.

1. For VAE, download the VAE model and place it in <path_to_comfyui>/models/vae/.

1. For the Flux model, download the weights and place them in <path_to_comfyui>/models/diffusion_models/. If you are unable to access the link, you can request model access on Hugging Face.

Now, you can use the Flux workflow. The Pruna node is directly connected to the Flux model, as shown here.

Enjoy the speed-up!

Wrapping Up

Congratulations! You have successfully integrated the Pruna node into ComfyUI.

For any questions, feedback or community discussions, feel free to join our Discord. where you can also get help from our dedicated help-desk channel.

For bug reports or technical issues, please open an issue in our repository.