Speedup Stable diffusion model Loading time

A1111 Webui

webui-user.bat
set COMMANDLINE_ARGS= --xformers --no-hashing --opt-channelslast --no-download-sd-model --lowram
set SAFETENSORS_FAST_GPU=1

stable-diffusion-webui/modules/sd_models.py
Switch
pl_sd = safetensors.torch.load_file(checkpoint_file, device=device)
by
pl_sd = safetensors.torch.load(open(checkpoint_file, 'rb').read())

pl_sd = safetensors.torch.load(open(checkpoint_file, 'rb').read())
pl_sd = {k: v.to(device) for k, v in pl_sd.items()}

Comfyui

Comfyui/Comfyui/comfy/utils.pyreplacing
sd = safetensors.torch.load_file(ckpt, device=device.type)
by
sd = safetensors.torch.load(open(ckpt, 'rb').read())

It will increased the speed from the HDD x6 times, from 15M/s to 200MB/s

Setting custom filenames in Stable Diffusion – Comfyui and Automatic1111 webui

The Stable Diffusion ComfyUI is a powerful GUI for AI image generation, but it’s also known for its limited documentation and steep learning curve for automatic1111 users.

By default, ComfyUI generated images will be dumped in the output folder with the meaningless filename ComfyUI_00001_.png with increasing numbers.

Continue reading “Setting custom filenames in Stable Diffusion – Comfyui and Automatic1111 webui”