Sharing models and custom nodes in ComfyUI

Magnopus
XRLO — eXtended Reality Lowdown
3 min readMar 20, 2024

by Marianne Gorczyca, Senior Pipeline Tools Developer

Introduction

The ability to create content in response to image or text-based prompts using Generative AI is a burgeoning interest in the sphere of Artificial Intelligence. Stable Diffusion models are a family of Generative AI models which was spearheaded by Stability AI in 2022 and are gaining in popularity. Stable Diffusion models are open source and allow you to train new models on your own datasets. While all diffusion models enable generating images from prompts, the technology used for Stable Diffusion requires less processing power and is more readily utilized on consumer-grade graphics cards. is a popular node-based Stable Diffusion graphical user interface (GUI) that generates images in response to positive and negative prompts.

Image generated using ComfyUI

Our goal

Here at Magnopus, as we’ve begun to use ComfyUI, we needed a way to share models and custom nodes among project team members. By default, ComfyUI uses ‘models’ and ‘custom_nodes’ folders that are part of its individual installation folder hierarchy. We wanted to save storage space and speed up ComfyUI onboarding by configuring resources once in a shared location.

We filled this need with ComfyUI’s ‘ — extra-model-paths-config’ command-line argument and pointed it to a shared network drive. At first glance, one might think that this argument is used to specify paths for models only. In fact, its value is a yaml file that points to additional locations for models as well as custom nodes.

Sample configuration

In this example, ‘extra_model_paths.yaml’ is in ‘X:\comfyui_models` which has subfolders ‘models’ and ‘custom_nodes’. The X drive in this example is mapped to a networked folder which allows for easy sharing of the models and nodes. The contents of the yaml file are shown below.

#config for comfyui

#your base path should be either an existing comfy install or a central folder where you store all of your models, loras, etc.

comfyui:
base_path: X:\\comfyui_models
checkpoints: models\checkpoints\
controlnet: models\controlnet\
custom_nodes: custom_nodes\
loras: models\loras\

The ‘extra_models_paths.yaml’ is supplied when ComfyUI is started from the command line as shown here:

python main.py --extra-model-paths-config X:\comfyui_models\extra_model_paths.yaml

Upon startup from the command line, the console output includes the information below, which shows that the paths specified in the yaml file are used in addition to the default locations.

Import times for custom nodes:
0.3 seconds: X:\\comfyui_models\custom_nodes\ComfyUI_UltimateSDUpscale
0.3 seconds: X:\\comfyui_models\custom_nodes\ComfyUI-Manager
0.7 seconds: X:\\comfyui_models\custom_nodes\comfyui_controlnet_aux
0.8 seconds: X:\\comfyui_models\custom_nodes\ComfyUI_Comfyroll_CustomNodes
1.9 seconds: X:\\comfyui_models\custom_nodes\ComfyUI-Inference-Core-Nodes
3.6 seconds: X:\\comfyui_models\custom_nodes\ComfyUI-Impact-Pack
3.8 seconds:C:\comfyui\ComfyUI\custom_nodes\was-node-suite-comfyui

Sample ComfyUI workflow

In this ComfyUI workflow, the ‘Image Save’ custom node is from ‘was-node-suite-comfyui’ on the C-drive and the ‘Image Luminance’ node is from ‘comfyui_controlnet_aux’ on the X-drive. Both nodes are found and the image is generated as desired.

I hope that this tip will save you time and effort when you use ComfyUI on your projects.

Originally published at https://www.magnopus.com on March 20, 2024.

--

--

Magnopus
XRLO — eXtended Reality Lowdown

Uniting the Physical and Digital Worlds. We've built #Expo2020Dubai and numerous experiences with #VR #AR #VirtualProduction, and products for the #Metaverse.