I’m doing some things on Windows again (windows 11 this time).
I’m messing around with stable diffusion and I have a problem: I have two seaprate stable diffusion UIs installed locally. I want to keep both.
Each UI has an internal directory that stores various stable diffusion model files used to generate the images (checkpoints, loras, etc).
That means that by default, if I want to use a model with both UIs, I need to have duplicate copies of the model file for each UI.
The model files can be big, with each checkpoint model around 2-4gb.
So I want to see if I cam save some space by using the same model files across multiple UIs.
It didn’t seem like the model directories paths could be configured, so my next thought was to see if I could use something like hard links.
This way way I can consolidate the models files in a centralized location and point the each UI models directory to the centralized location.
My window-foo is a bit rusty, but one of the UI’s docs suggests
mklink /j could help do this.
I tried it in PowerShell first, but got a command not found error.
> mklink /j 'C:\ui-1\models\sd-models' '.\ui-2\models\stable-diffusion'
I Google’d and apprently it’s something built into
cmd.exe and not an executable we can invoke from PowerShell, so we need to open a regular command prompt.
Tried mklink in
cmd.exe and got a different error:
The filename, directory name, or volume label syntax is incorrect.
This is a bit broad so at first I thought maybe the relative path was the issue so I expanded it out:
> mklink /j 'C:\ui-1\models\sd-models' 'C:\Users\Felix\ui-2\models\stable-diffusion'
but still got the same error.
I was stumped for a second and double checked that the paths were valid.
Eventually it occured to me that it might be the quotes so I switched from single to double quotes and the command went through.
I verified that the hard link worked by generating some images using both stable diffusion UIs.
One downside of this approach is that if I were to install a new stable diffusion tool in the future, I may need to create new hard links.
Also, I noticed that the new hard links were not accessible as directories via SMB. I use SMB to share some of my Windows filepaths over LAN so that I can easily transfer files to/from my Macbook.