city96 / ComfyUI_ExtraModels

Support for miscellaneous image models. Currently supports: DiT, PixArt, HunYuanDiT, MiaoBi, and a few VAEs.
Apache License 2.0
388 stars 34 forks source link

About how to load parameters from other folder #30

Open polop08 opened 6 months ago

polop08 commented 6 months ago

Thank you for answering my eariler questions. Now I have updated my pytorch and cuda version and use sd 1.5 models for vae. But due to my limited disk storage, I have to download Pixart model to the folder

/data/Pixart_Alpha/PixArt-alpha

Where the checkpoints, t5, vae are stored in the

/data/Pixart_Alpha/PixArt-alpha/t5/t5-v1_1-xxl /data/Pixart_Alpha/PixArt-alpha/vae/sd-vae-ft-ema

and I install comfy UI in

/home/polop

I tried to modify extra_model_paths.yaml as

base_path: /data/Pixart_Alpha/Pixart-alpha checkpoints: /data/Pixart_Alpha/Pixart-alpha vae: /data/Pixart_Alpha/Pixart-alpha/sd-vae-ft-ema

However, that doesn't seem work for me. The file list in GUI is null and I can't find where to modify the path to t5 folder. Could i ask how to modify the path to these data folders so that GUI could load parameter from them? Thank you for your help

city96 commented 6 months ago

I've pushed an update that should allow changing the path to T5 with just the extra model paths yaml.

As for what you should put in that file, it depends on your folder layout. The base path is the folder where it expects all the named subfolders to be, all the other named keywords are expected to be foldernames inside that base folder.

So if your folders look like this:

/data/Pixart_Alpha/PixArt-alpha/models/
/data/Pixart_Alpha/PixArt-alpha/t5/
/data/Pixart_Alpha/PixArt-alpha/vae/

Then your config should look like this:

PixArt:
    base_path: /data/Pixart_Alpha/PixArt-alpha/
    checkpoints: models
    t5: t5
    vae: vae

PS: I assume your previous issue with the VAE is solved then? I'll mark it as closed unless you want to ask anything else there, but you can always reopen it.

polop08 commented 6 months ago

Thank you for your previous help, the vae issue is solved. But for this one, I am not sure if i did anything wrong, i modify the extra_model_path.yaml as

PixArt: base_path: /data/Pixart_Alpha/Pixart-alpha t5: t5 checkpoints: ./ vae: vae configs: /home/ComfyUI/custom_nodes/ComfyUI_ExtraModels/PixArt

When I download comfyUI, i just download it in my home folder since it is not a big file. Also, but when i download pixart model from the repo using git lfs, i download it in the folder

/data/Pixart_Alpha

and the file inside it will be like

/data/Pixart_Alpha/Pixart-alpha/t5/t5-v1_1-xxl/pytorch_model-00001-of-00002.bin ... /data/Pixart_Alpha/Pixart-alpha/vae/sd-vae-ft-ema/diffustion_pythorch_model.bin /data/Pixart_Alpha/Pixart-alpha/PixArt-image-to-image-workflow.json ... /data/Pixart_Alpha/Pixart-alpha/PixArt-XL-2-1024-MS.pth ...

I put every file i get from

git clone https://huggingface.co/PixArt-alpha/PixArt-alpha

And it turned out that the loader still can't find the correct path to the file

image

could i ask is there anything i could revise so that i could solve the issue? Thank you for your help!

city96 commented 6 months ago

From that snipped you pasted, the "configs" bit still has the full path, not sure if that's causing the whole thing to be ignored. I gave it a quick test and "./" seems to work, although it's not the best since it will list all the subfolders (so t5/the vae files) in checkpoints as well. Also, the 'configs' part isn't used anyway, so might as well remove it and just try with this:

PixArt:
    base_path: /data/Pixart_Alpha/Pixart-alpha
    checkpoints: ./
    t5: t5
    vae: vae

You're restarting comfy / reloading the UI after each modification right?

polop08 commented 6 months ago

Yes, I tried modify the yaml to the same as you wrote, and restart comfy

`╰─$ python main.py Total VRAM 48677 MB, total RAM 257776 MB Set vram state to: NORMAL_VRAM Device: cuda:0 NVIDIA RTX A6000 : cudaMallocAsync VAE dtype: torch.bfloat16 Using pytorch cross attention Adding extra search path t5 /data/Pixart_Alpha/Pixart-alpha/t5 Adding extra search path checkpoints /data/Pixart_Alpha/Pixart-alpha/./ Adding extra search path vae /data/Pixart_Alpha/Pixart-alpha/vae

Import times for custom nodes: 0.0 seconds: /home/polop/ComfyUI/custom_nodes/websocket_image_save.py 0.0 seconds: /home/polop/ComfyUI/custom_nodes/ComfyUI_ExtraModels

Starting server

To see the GUI go to: http://127.0.0.1:8188 `

Still, the loader cound't locate the .bin or .pth file, leaving only 'undifined' in my UI

image

how to define the path to the file for the loaders? thank you for all your assitance!

city96 commented 6 months ago

Click where it says "unidentified" and select it from the list?

polop08 commented 6 months ago

I click on it and still it shows undefined. it won't pop up a list of files to choose from but only show 'undefined' and nothing happens when i click on it.

city96 commented 6 months ago

Huh, odd. The path is correct in the log from the info you provided so that's not it, and if you refreshed the UI then that shouldn't be the issue either.

Maybe you could try to set up a simple stable diffusion 1.5 workflow in base ComfyUI (without any custom nodes, and using the default workflow). I recommend you make separate folders for checkpoints/etc instead of reusing the PixArt folder to make it more clear, e.g. /data/models/ as the base folder with subfolders like checkpoints, vae, etc.

If that also doesn't work, then I recommend opening an issue on the original ComfyUI repository. If it does work then you can reenable the custom nodes. Move the PixArt checkpoint(s) to your new /data/models/checkpoints folders, and move T5 to /data/models/t5 then add it to the extra paths yaml. If that is the step that breaks it, then it's an issue with my node and I'll investigate further.