comfyanonymous / ComfyUI

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface.
https://www.comfy.org/
GNU General Public License v3.0
50.59k stars 5.31k forks source link

Universal was to get state_dict keys for svd model? #4145

Open 311-code opened 1 month ago

311-code commented 1 month ago

Your question

On a custom node I am making, I have spent months trying to get the actual state_dict keys for the svd model as they don't match the huggingface names when you click the little layer icon. I need the comfyui post prefixed names for clip_vision, unet. I want it to print all of the names used and even the open clip ones after positional.embedding.

I noticed comfyui renames a bunch of the state_dict key prefixes and this makes it very difficult for targeting weight and bias layers directly when using comfyui. I think I am definitely missing something here. I see some classes that include layer_idx at least, but when I use their methods to get the state_dict keys (after importing) it doesn't work.

In addition, can we get some comments for sd1_clip.py, the sdxl_clip.py, the class SDXLClipG, the SDXLClipGTokenizer, and other classes like that. These seems to be exactly what I am looking but it took 4 months to finally discover them. I need to be able to get the actual state_dict names comfyui renames everything in the svd model to.

I don't mind the state_dict_prefix_replace in the sd.py if it's necessary, but there needs to still be a way to get the prefixed names. Unless I am missing something here. Thanks!

comfyanonymous commented 1 month ago

https://github.com/comfyanonymous/ComfyUI/blob/master/comfy/model_patcher.py#L258

You can call .state_dict() on the MODEL object.

github-actions[bot] commented 1 week ago

This issue is being marked stale because it has not had any activity for 30 days. Reply below within 7 days if your issue still isn't solved, and it will be left open. Otherwise, the issue will be closed automatically.