ljleb / comfy-mecha

Executable Stable Diffusion merge recipes in comfyui
MIT License
56 stars 3 forks source link

[Suggestion] Custom config to access all blocks #4

Closed fernicar closed 3 months ago

fernicar commented 3 months ago

Amazing custom node, works great! I would like to suggest a feature to input custom config to register a temp model arch, it should enable us to get access for:

which isn't posible without editing python's library files such as: (PYTHON OR VENV)\Lib\site-packages\sd_mecha\models\sd1_ldm.yaml" and restarting ComfyUI. Perhaps a folder do load SD2/SD3 keys.txt too.

Here is an example workflow to test extra blocks and the config needed: request_custom_arch_config

ljleb commented 3 months ago

Actually, there is an undocumented way of doing this. You can register a config the same way as the library does it: https://github.com/ljleb/sd-mecha/blob/main/sd_mecha/builtin_model_archs.py

Calling sd_mecha.extensions.model_arch.register_model_arch() inside of the mecha_extensions directory will properly register new model architectures, regardless of how much they overlap with existing ones.

So you could define your own configs by copying the existing ones and then modifying them. Just be sure to use a different arch identifier, and to use the same identifier for all merge recipe inputs when using it.

This does still require a restart. It would need a few more changes to implement custom architectures as part of a comfyui workflow.

I'm aware the current config style is not perfect, I am not super happy with having to specify all the keys manually for example. It would be nice to be able to generate them from pytorch code, if that can be made inexpensive / not require instantiating the memory of the model.

It would be best to create custom nodes based on a more stable config implementation, like that we won't have to break older workflows, or at least it will happen less often and to more minor parts of workflows.

fernicar commented 3 months ago

Thanks, then I will use this 3 files as a mecha_extensions: comfy-mecha_sd15_with_31_blocks.zip Here is the list of blocks again: request_custom_arch_config (2)