ComfyUI/comfy
Jacob Segal b234baee2c Add lazy evaluation and dynamic node expansion
This PR inverts the execution model -- from recursively calling nodes to
using a topological sort of the nodes. This change allows for
modification of the node graph during execution. This allows for two
major advantages:
1. The implementation of lazy evaluation in nodes. For example, if a
   "Mix Images" node has a mix factor of exactly 0.0, the second image
   input doesn't even need to be evaluated (and visa-versa if the mix
   factor is 1.0).
2. Dynamic expansion of nodes. This allows for the creation of dynamic
   "node groups". Specifically, custom nodes can return subgraphs that
   replace the original node in the graph. This is an *incredibly*
   powerful concept. Using this functionality, it was easy to
   implement:
   a. Components (a.k.a. node groups)
   b. Flow control (i.e. while loops) via tail recursion
   c. All-in-one nodes that replicate the WebUI functionality
   d. and more
All of those were able to be implemented entirely via custom nodes
without hooking or replacing any core functionality. Within this PR,
I've included all of these proof-of-concepts within a custom node pack.
In reality, I would expect some number of them to be merged into the
core node set (with the rest left to be implemented by custom nodes).

I made very few changes to the front-end, so there are probably some
easy UX wins for someone who is more willing to wade into .js land. The
user experience is a lot better than I expected though -- progress shows
correctly in the UI over the nodes that are being expanded.
2023-07-18 20:08:12 -07:00
..
cldm Support base SDXL and SDXL refiner models. 2023-06-22 13:03:50 -04:00
extra_samplers Refactor of sampler code to deal more easily with different model types. 2023-07-17 01:22:12 -04:00
k_diffusion Only calculate randn in some samplers when it's actually being used. 2023-07-17 10:11:08 -04:00
ldm It's actually possible to torch.compile the unet now. 2023-07-18 21:36:35 -04:00
sd1_tokenizer Initial commit. 2023-01-16 22:37:14 -05:00
t2i_adapter Make t2i adapter work with any latent resolution. 2023-05-08 18:15:19 -04:00
taesd Refactor previews into one command line argument. 2023-06-06 02:13:05 -04:00
checkpoint_pickle.py Remove pytorch_lightning dependency. 2023-06-13 10:11:33 -04:00
cli_args.py Enable --cuda-malloc by default on torch 2.0 and up. 2023-07-17 15:12:10 -04:00
clip_config_bigg.json This is unused but it should be 1280. 2023-06-28 18:04:23 -04:00
clip_vision_config_h.json Add support for unCLIP SD2.x models. 2023-04-01 23:19:15 -04:00
clip_vision_config_vitl.json Add support for unCLIP SD2.x models. 2023-04-01 23:19:15 -04:00
clip_vision.py Fix error with ClipVision loader node. 2023-06-23 01:08:05 -04:00
diffusers_convert.py Add CheckpointSave node to save checkpoints. 2023-06-26 12:22:27 -04:00
diffusers_load.py Support loading unet files in diffusers format. 2023-07-05 17:38:59 -04:00
gligen.py Disable autocast in unet for increased speed. 2023-07-05 21:58:29 -04:00
graph_utils.py Add lazy evaluation and dynamic node expansion 2023-07-18 20:08:12 -07:00
latent_formats.py Support SDXL embedding format with 2 CLIP. 2023-07-10 10:34:59 -04:00
model_base.py Add key to indicate checkpoint is v_prediction when saving. 2023-07-18 00:25:53 -04:00
model_detection.py Support loading unet files in diffusers format. 2023-07-05 17:38:59 -04:00
model_management.py Fix device print on old torch version. 2023-07-17 15:18:58 -04:00
ops.py Properly disable weight initialization in clip models. 2023-06-14 20:13:08 -04:00
sample.py Disable autocast in unet for increased speed. 2023-07-05 21:58:29 -04:00
samplers.py Refactor of sampler code to deal more easily with different model types. 2023-07-17 01:22:12 -04:00
sd1_clip_config.json Initial commit. 2023-01-16 22:37:14 -05:00
sd1_clip.py Fix CLIPSetLastLayer not reverting when removed. 2023-07-15 01:41:21 -04:00
sd2_clip_config.json Use transformers CLIP instead of open_clip for SD2.x 2023-02-05 14:36:28 -05:00
sd2_clip.py Fix CLIPSetLastLayer not reverting when removed. 2023-07-15 01:41:21 -04:00
sd.py Refactor of sampler code to deal more easily with different model types. 2023-07-17 01:22:12 -04:00
sdxl_clip.py Fix CLIPSetLastLayer not reverting when removed. 2023-07-15 01:41:21 -04:00
supported_models_base.py Refactor of sampler code to deal more easily with different model types. 2023-07-17 01:22:12 -04:00
supported_models.py Refactor of sampler code to deal more easily with different model types. 2023-07-17 01:22:12 -04:00
utils.py Speed up lora loading a bit. 2023-07-15 13:25:22 -04:00