alexopus / ComfyUI-Image-Saver

Allows you to save images with their generation metadata in ComfyUI. Compatible with Civitai. Works with png, jpeg and webp.
MIT License
31 stars 6 forks source link

Bug: basemodelname for a model in a folder includes the folder name #5

Closed ManOrMonster closed 5 months ago

ManOrMonster commented 6 months ago

Issue

When a checkpoint is in a folder, basemodel names display the folder name in metadata and in file name (which results in an error).

For instance, this model: ".SDXL\samaritanCGI_v10.safetensors"

Using this naming method: %time [%seed] [%basemodelname]

results in:

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\stable-diffusion\\data\\outputs\\comfyUI\\2024-01-06\\2024-01-06-164431 [298964781848263] [.SDXL\\samaritanCGI_v10.safetensors].jpeg'

Removing %basemodel form the naming method saves the file, but the model name in the metadata is ".SDXL\samaritanCGI_v10.safetensors".

Solution

Change this line in def parse_name(ckpt_name):

path = ckpt_name to path = ckpt_name.replace("\\", "/")