ai-dock / comfyui

ComfyUI docker images for use in GPU cloud and local environments. Includes AI-Dock base for authentication and improved user experience.
Other
650 stars 224 forks source link

How to make comfyui and webui share the same models directory? #9

Closed SoaringTiger closed 11 months ago

SoaringTiger commented 1 year ago

I'm using ai-dock/comfyui and ai-dock/stable-diffusion-webui together. I want to ask how to share the models directory between these two projects like https://github.com/AbdBarho/stable-diffusion-webui-docker

robballantyne commented 1 year ago

I've been thinking about this.

I've recently made a change so that synchronized micromamba environments can exist in a shared volume mount.

I'm going to implement a 'model repository' system where all containers will look for models so they can be easily shared.

In the meantime, I'd recommend downloading models for one system and symlink them to the correct directories in the other.

This is quite important so I'll start work on automating it immediately.

robballantyne commented 11 months ago

@SoaringTiger I've now pushed an update to the a1111 repo so that it also uses the new /workspace/storage directories for saving models.

The best way to manage this is to mount /path/to/local/storage/ in the container at /workspace/storage - You can see the required structures at

https://github.com/ai-dock/comfyui/tree/main/build/COPY_ROOT_EXTRA/opt/storage/ and

https://github.com/ai-dock/stable-diffusion-webui/tree/main/build/COPY_ROOT_EXTRA/opt/storage

The mappings to make this work for each container are at

https://github.com/ai-dock/comfyui/blob/main/build/COPY_ROOT/opt/ai-dock/storage_monitor/etc/mappings.sh

and

https://github.com/ai-dock/stable-diffusion-webui/blob/main/build/COPY_ROOT/opt/ai-dock/storage_monitor/etc/mappings.sh

I will use this structure for all future SD docker images (Fooocus, Invoke etc.)

SoaringTiger commented 11 months ago

@robballantyne

If there are subdirectories in the model directory, recursive symlinks will be generated.

There is a ‘Turbo’ subdirectory in ckpt, looks just like the picture below.

Screen Shot 2023-12-20 at 3 13 27 PM

robballantyne commented 11 months ago

Thanks, I'll fix. Only the directory 'turbo' should be linked

robballantyne commented 11 months ago

New builds should solve this issue. Please let me know if not and thank you for your report 🙏

SoaringTiger commented 11 months ago

New builds should solve this issue. Please let me know if not and thank you for your report 🙏

Tested, simple to use and works well 👍