How to share model files when multiple sets of Stable Diffusion are installed on one computer

avantcontra
5 min readOct 23, 2023

--

I have three sets of Stable Diffusion ui installed on my computer:

  • a1111 webui
  • comfyui
  • 秋叶整合包( An integrated package of SD webui)

There are a bunch of large models, LoRA, ControlNet, plus some VAE, upscale enlargement models, etc. The ones I commonly use are about 90G. Copying three copies takes up a lot of space, and updating the version is also troublesome.

You can put all the models in one location, and then specify the model location for each SD UI.

There are usually two methods:
Mklink and Command line parameters.

1. Mklink (symbolic link)

It is similar to a folder pointer or shortcut, which allows the model folders of each SD UI, such as models, to point to the same centrally stored model folder.

Example, use mklink to create a symbolic link to point the A directory on the C drive to the B directory on the D drive:

mklink /d C:\XXX\A D:\XXX\B

Microsoft mklink documentation:

https://learn.microsoft.com/zh-cn/windows-server/administration/windows-commands/mklink

For example my model folder is:

D:\ai\models\sd\webui_using

Some commonly used model files are classified under this folder:

Taking SD webui as an example, map the models folder under its installation directory stable-diffusion-webui to webui_using in the above figure through mklink:

Open the cmd command prompt and run:

mklink /d H:\prjs\sd\webui\automatic1111\stable-diffusion-webui\models D:\ai\models\sd\webui_using

Note that all models in models are moved to webui_using in advance If the creation fails, you can delete the empty models folder and try again. Remember to back up the model in advance to prevent deletion errors.

This is fine and can be used for simple tests, but some people in the webui community say that some plug-ins are not compatible with this method.

2. Command line startup parameters

I am now using the second method, which is to use the command line startup parameters to specify the corresponding model location .

There are parameter variables corresponding to various folders on the GitHub of Stable Diffusion A1111 webui:

https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Command-Line-Arguments-and-Settings

Take mine as an example:

Includes large models, VAE, textural inversion, LoRA, upscaler, controlnet, etc.

(1). For Stable Diffusion A1111 webui:

Add the above parameters after COMMANDLINE_ARGS in the webui-user.bat file in the webui installation root directory :

hint:

  • Do not leave a blank line for each parameter after COMMANDLINE_ARGS. Write them together into one line and separate them with spaces.
  • It is best to change \ in the original Windows path to / , that is:
D:\ai\models\sd\webui_using\XXX

Change to:

D:/ai/models/sd/webui_using/XXX

Just run webui-user.bat and start it normally.

(2). For the 秋叶包:

Copy and paste the startup parameters in the Advanced Options on the left side of the launcher -> Custom parameters at the bottom :

Just paste the model folder parameters that need to be changed. You can use line breaks here, one per line.

Just start the SD normally.

(3). For ComfyUI:

The custom parameters of Comf yUI are stored in the extra_model_paths.yaml file in its root directory. The default file is extra_model_paths.yaml.example. You can directly change the file name or copy and rename it.

Then open it with a text editor.

By default, the model file location of A1111 webui is directly specified here, and then ComfyUI will load it. If you only use these two sets of UI, you can slightly modify the default ones.

If you are like me and have 秋叶包 and other XXX UIs, you can specifically specify and comment out the A1111 part:

Tip, also change \ in the original Windows path to /.

Just start ComfyUI normally.

At this point, most of the model files have been specified. If you only need to specify one or two folders, that is fine. For example, only large models, LoRA, and ControlNet are specified. Usually these three files take up the most space.

There is a special case, AnimateDiff , which currently has no startup parameters in webui, but is set in the Settings after webui is started .

Start webui, in Settings, find AnimateDiff at the bottom left, and then fill in the model folder path of AnimateDiff at the top. There is no need to modify \ to / here :

The same goes for 秋叶包.

In ComfyUI, add a custom_nodes in the extra_model_paths.yaml configuration file , followed by the AnimateDiff model folder path (not tested yet, but it should be OK).

custom_nodes: path/custom_nodes

Cheers🍻

MORE articles and videos:

Buy me a coffee:

https://www.patreon.com/avantcontra
There are many articles, patches, source code and some advanced Patron-only content there.

Or you can get a source code/patch directly in gumroad. https://gumroad.com/avantcontra

[实验编程 Experimental Programming], meaning is derived from experimental art, experimental electronics, or experimental music. And that’s how I create things through programming.

Contra

--

--

avantcontra
avantcontra

Written by avantcontra

Digital artist, creative technologist. Interactive media/AI/generative art. avantcontra.com