Commit Graph

145 Commits

Author SHA1 Message Date
comfyanonymous
0bfc7cc998 Create the temp directory on ComfyUI startup instead. 2024-09-18 09:55:57 -04:00
Robin Huang
b962db9952
Add cli arg to override user directory (#4856)
* Override user directory.

* Use overridden user directory.

* Remove prints.

* Remove references to global user_files.

* Remove unused replace_folder function.

* Remove newline.

* Remove global during get_user_directory.

* Add validation.
2024-09-12 08:10:27 -04:00
comfyanonymous
bc94662b31 Cleanup. 2024-09-10 00:43:37 -04:00
Robin Huang
9fa8faa44a
Expand user directory for basepath in extra_models_paths.yaml (#4857)
* Expand user path.

* Add test.

* Add unit test for expanding base path.

* Simplify unit test.

* Remove comment.

* Remove comment.

* Checkpoints.

* Refactor.
2024-09-10 00:33:44 -04:00
comfyanonymous
22d1241a50 Add an experimental LoraSave node to extract model loras.
The model_diff input should be connected to the output of a
ModelMergeSubtract node.
2024-09-04 16:38:38 -04:00
Chenlei Hu
e91662e784
Get logs endpoint & system_stats additions (#4690)
* Add route for getting output logs

* Include ComfyUI version

* Move to own function

* Changed to memory logger

* Unify logger setup logic

* Fix get version git fallback

---------

Co-authored-by: pythongosssss <125205205+pythongosssss@users.noreply.github.com>
2024-08-30 12:46:37 -04:00
comfyanonymous
4f7a3cb6fb unet -> diffusion_models. 2024-08-17 21:31:04 -04:00
guill
5cfe38f41c
Execution Model Inversion (#2666)
* Execution Model Inversion

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,
    so those features are *not* a part of this PR. (There are some
    front-end changes that should occur before that functionality is
    made widely available, particularly around variant sockets.)

The custom nodes associated with this PR can be found at:
https://github.com/BadCafeCode/execution-inversion-demo-comfyui

Note that some of them require that variant socket types ("*") be
enabled.

* Allow `input_info` to be of type `None`

* Handle errors (like OOM) more gracefully

* Add a command-line argument to enable variants

This allows the use of nodes that have sockets of type '*' without
applying a patch to the code.

* Fix an overly aggressive assertion.

This could happen when attempting to evaluate `IS_CHANGED` for a node
during the creation of the cache (in order to create the cache key).

* Fix Pyright warnings

* Add execution model unit tests

* Fix issue with unused literals

Behavior should now match the master branch with regard to undeclared
inputs. Undeclared inputs that are socket connections will be used while
undeclared inputs that are literals will be ignored.

* Make custom VALIDATE_INPUTS skip normal validation

Additionally, if `VALIDATE_INPUTS` takes an argument named `input_types`,
that variable will be a dictionary of the socket type of all incoming
connections. If that argument exists, normal socket type validation will
not occur. This removes the last hurdle for enabling variant types
entirely from custom nodes, so I've removed that command-line option.

I've added appropriate unit tests for these changes.

* Fix example in unit test

This wouldn't have caused any issues in the unit test, but it would have
bugged the UI if someone copy+pasted it into their own node pack.

* Use fstrings instead of '%' formatting syntax

* Use custom exception types.

* Display an error for dependency cycles

Previously, dependency cycles that were created during node expansion
would cause the application to quit (due to an uncaught exception). Now,
we'll throw a proper error to the UI. We also make an attempt to 'blame'
the most relevant node in the UI.

* Add docs on when ExecutionBlocker should be used

* Remove unused functionality

* Rename ExecutionResult.SLEEPING to PENDING

* Remove superfluous function parameter

* Pass None for uneval inputs instead of default

This applies to `VALIDATE_INPUTS`, `check_lazy_status`, and lazy values
in evaluation functions.

* Add a test for mixed node expansion

This test ensures that a node that returns a combination of expanded
subgraphs and literal values functions correctly.

* Raise exception for bad get_node calls.

* Minor refactor of IsChangedCache.get

* Refactor `map_node_over_list` function

* Fix ui output for duplicated nodes

* Add documentation on `check_lazy_status`

* Add file for execution model unit tests

* Clean up Javascript code as per review

* Improve documentation

Converted some comments to docstrings as per review

* Add a new unit test for mixed lazy results

This test validates that when an output list is fed to a lazy node, the
node will properly evaluate previous nodes that are needed by any inputs
to the lazy node.

No code in the execution model has been changed. The test already
passes.

* Allow kwargs in VALIDATE_INPUTS functions

When kwargs are used, validation is skipped for all inputs as if they
had been mentioned explicitly.

* List cached nodes in `execution_cached` message

This was previously just bugged in this PR.
2024-08-15 11:21:11 -04:00
Robin Huang
3e52e0364c
Add model downloading endpoint. (#4248)
* Add model downloading endpoint.

* Move client session init to async function.

* Break up large function.

* Send "download_progress" as websocket event.

* Fixed

* Fixed.

* Use async mock.

* Move server set up to right before run call.

* Validate that model subdirectory cannot contain relative paths.

* Add download_model test checking for invalid paths.

* Remove DS_Store.

* Consolidate DownloadStatus and DownloadModelResult

* Add progress_interval as an optional parameter.

* Use tuple type from annotations.

* Use pydantic.

* Update comment.

* Revert "Use pydantic."

This reverts commit 7461e8eb00.

* Add new line.

* Add newline EOF.

* Validate model filename as well.

* Add comment to not reply on internal.

* Restrict downloading to safetensor files only.
2024-08-13 15:48:52 -04:00
comfyanonymous
19944ad252 Add code to fix issues with new pytorch version on the standalone. 2024-07-24 12:49:29 -04:00
comfyanonymous
b4c2d03d47 Remove duplicate import. 2024-07-05 12:10:22 -04:00
comfyanonymous
bd2d3e27d7 Show comfy_extras warning at the end.
Remove code.
2024-07-04 21:44:27 -04:00
Chenlei Hu
9dd549e253
Add --no-custom-node cmd flag (#3903)
* Add --no-custom-node cmd flag

* nit
2024-07-01 17:54:03 -04:00
Garrett Sutula
bacce529fb
Add TLS Support (#3312)
* Add TLS Support

* Add to readme

* Add guidance for windows users on generating certificates

* Add guidance for windows users on generating certificates

* Fix typo
2024-04-30 20:17:02 -04:00
comfyanonymous
6a32c06f06 Move cleanup_models to improve performance. 2024-03-23 17:27:10 -04:00
comfyanonymous
2a813c3b09 Switch some more prints to logging. 2024-03-11 16:34:58 -04:00
comfyanonymous
e61755ead0 Update the old updater if present when running on the windows standalone. 2024-02-26 13:32:14 -05:00
comfyanonymous
56d9496b18 Rename status notes to status messages.
I think message describes them better.
2024-01-12 18:17:06 -05:00
realazthat
1b3d65bd84 Add error, status to /history endpoint 2024-01-11 10:16:42 -05:00
comfyanonymous
6d281b4ff4 Add a /free route to unload models or free all memory.
A POST request to /free with: {"unload_models":true}
will unload models from vram.

A POST request to /free with: {"free_memory":true}
will unload models and free all cached data from the last run workflow.
2024-01-04 17:15:22 -05:00
comfyanonymous
66831eb6e9 Add node id and prompt id to websocket progress packet. 2024-01-01 14:27:56 -05:00
comfyanonymous
2f9d6a97ec Add --deterministic option to make pytorch use deterministic algorithms. 2023-12-17 16:59:21 -05:00
comfyanonymous
6b769bca01 Do a garbage collect after the interval even if nothing is running. 2023-11-30 15:22:32 -05:00
comfyanonymous
b911eefc42 Limit gc.collect() to once every 10 seconds. 2023-11-28 14:20:56 -05:00
comfyanonymous
be903eb2e2 Add default CheckpointSave, CLIPSave and VAESave paths to model paths. 2023-10-10 01:25:47 -04:00
Jairo Correa
63e5fd1790 Option to input directory 2023-10-04 19:45:15 -03:00
comfyanonymous
3039b08eb1 Only parse command line args when main.py is called. 2023-09-13 11:38:20 -04:00
comfyanonymous
326577d04c Allow cancelling of everything with a progress bar. 2023-09-07 23:37:03 -04:00
comfyanonymous
861fd58819 Add a warning if a card that doesn't support cuda malloc has it enabled. 2023-08-13 12:37:53 -04:00
comfyanonymous
2bc12d3d22 Add --temp-directory argument to set temp directory. 2023-08-11 05:13:03 -04:00
comfyanonymous
eb5191f911 0.0.0.0 doesn't work on windows. 2023-08-01 01:15:18 -04:00
comfyanonymous
ccb6b70de1 Move image encoding outside of sampling loop for better preview perf. 2023-07-19 18:06:58 -04:00
comfyanonymous
799c08a4ce Auto disable cuda malloc on some GPUs on windows. 2023-07-19 14:43:55 -04:00
comfyanonymous
9871a15cf9 Enable --cuda-malloc by default on torch 2.0 and up.
Add --disable-cuda-malloc to disable it.
2023-07-17 15:12:10 -04:00
comfyanonymous
1679abd86d Add a command line argument to enable backend:cudaMallocAsync 2023-07-17 11:00:14 -04:00
comfyanonymous
6f914fb77d Print prestartup times for custom nodes. 2023-07-13 13:01:45 -04:00
Dr.Lt.Data
99abcbef41
feat/startup-script: Feature to avoid package installation errors when installing custom nodes. (#856)
* support startup script for installation without locking on windows

* modified: Instead of executing scripts from the startup-scripts directory, I will change it to execute the prestartup_script.py for each custom node.
2023-07-11 02:33:21 -04:00
comfyanonymous
103c487a89 Cleanup. 2023-07-02 11:58:23 -04:00
comfyanonymous
d52ed407a7 Send websocket message only when prompt is actually done executing. 2023-06-13 13:38:43 -04:00
reaper47
5cf4079923 Give linux some love 2023-06-07 15:15:38 +02:00
space-nuko
48f7ec750c Make previews into cli option 2023-06-05 13:19:02 -05:00
space-nuko
38bc02bb40 Fix 2023-06-05 09:20:20 -05:00
space-nuko
b4f434ee66 Preview sampled images with TAESD 2023-06-05 09:20:17 -05:00
comfyanonymous
1dd846a7ba Fix outputs gone from history. 2023-05-15 00:27:28 -04:00
comfyanonymous
dfc74c19d9 Add the prompt_id to some websocket messages. 2023-05-11 01:22:40 -04:00
comfyanonymous
d6dee8af1d Only validate each input once. 2023-05-10 00:29:31 -04:00
EllangoK
8e03c789a2 auto-launch cli arg 2023-05-06 16:59:40 -04:00
comfyanonymous
93c64afaa9 Use sampler callback instead of tqdm hook for progress bar. 2023-05-02 23:00:49 -04:00
comfyanonymous
74fc7b7726 custom_nodes paths can now be set in the extra_model_paths.yaml 2023-04-16 01:46:43 -04:00
EllangoK
28fff5d1db fixes lack of support for multi configs
also adds some metavars to argarse
2023-04-06 19:06:39 -04:00
EllangoK
e5e587b1c0 seperates out arg parser and imports args 2023-04-05 23:41:23 -04:00
EllangoK
dd29966f8a changes main.py to use argparse 2023-04-05 22:36:40 -04:00
comfyanonymous
f816964847 Add a way to set output directory with --output-directory 2023-04-05 14:29:30 -04:00
comfyanonymous
6be7c64245 Merge branch 'custom_routes' of https://github.com/pythongosssss/ComfyUI 2023-04-02 01:55:05 -04:00
comfyanonymous
66f1f57615 Add --extra-model-paths-config to --help. 2023-04-02 01:54:44 -04:00
pythongosssss
313f1f83a6 Tweak server/custom node load order
- Load custom nodes after creating server
 - Add routes after loading custom nodes
Custom nodes can now add routes via PromptServer.instance
2023-04-01 12:44:29 +01:00
comfyanonymous
5218e5d596 Command line option to set CUDA device. 2023-03-29 23:28:21 -04:00
comfyanonymous
31dd6c0531 Add way to specify listen ip with --listen. 2023-03-28 01:42:34 -04:00
comfyanonymous
51d6427ddf Add support for loading extra paths from yaml file.
Rename extra_model_paths.yaml.example to extra_model_paths.yaml and edit
it to point to your other UI.
2023-03-18 02:52:43 -04:00
comfyanonymous
5ad9f86514 Do a quick test on the CI to see if ComfyUI actually runs before pushing
the build.
2023-03-14 23:02:57 -04:00
comfyanonymous
ff255d9dcd Make sure windows permission issues don't mess things up. 2023-03-14 18:07:09 -04:00
pythongosssss
6db777b348 Added ability to save images to temp dir 2023-03-13 19:34:05 +00:00
comfyanonymous
83f23f82b8 Add pytorch attention support to VAE. 2023-03-13 12:45:54 -04:00
comfyanonymous
a256a2abde --disable-xformers should not even try to import xformers. 2023-03-13 11:36:48 -04:00
comfyanonymous
0f3ba7482f Xformers is now properly disabled when --cpu used.
Added --windows-standalone-build option, currently it only opens
makes the code open up comfyui in the browser.
2023-03-12 15:44:16 -04:00
comfyanonymous
afff30fc0a Add --cpu to use the cpu for inference. 2023-03-06 10:50:50 -05:00
comfyanonymous
49d2e5bb5a Move some stuff from main.py to execution.py 2023-02-27 19:44:58 -05:00
comfyanonymous
c0fb0c848f Update colab notebook. 2023-02-25 22:49:22 -05:00
comfyanonymous
6de6246dd4 Fix some potential issues related to threads. 2023-02-25 18:36:29 -05:00
pythongosssss
9f391ab656
changed to store history by uniqueid
fixed removing history items
2023-02-23 21:25:08 +00:00
pythongosssss
5c5725dac0
Remove extra args 2023-02-23 20:21:58 +00:00
pythongosssss
9bd7bfa648
Added workflow history
Moved socket output updates to all node executions
Made image rendering on nodes more generic
2023-02-23 20:12:57 +00:00
pythongosssss
a52aa9f4b5
Moved api out to server
Reworked sockets to use socketio
Added progress to nodes
Added highlight to active node
Added preview to saveimage node
2023-02-21 19:29:49 +00:00
comfyanonymous
5f375f0d16 Remove my "deleted" debug print that confused people. 2023-02-21 01:28:08 -05:00
masterpiecebestquality
3a83da7281 empty cache after execute() 2023-02-20 13:56:34 -05:00
comfyanonymous
a38a30cb87 Document --highvram and enable it in colab. 2023-02-17 21:32:27 -05:00
pythongosssss
0787299610
Hide Triton warning on Windows
Triton doesnt work on Windows so hide the error
2023-02-16 18:19:26 +00:00
pythongosssss
68a1ac7746
Remove catch that was causing linux ctrl+c issues
This was for hiding an error on Windows, but it isn't required
2023-02-13 20:12:12 +00:00
pythongosssss
8e51af6786
Changed to serve index.html on root 2023-02-13 17:58:03 +00:00
pythongosssss
f616dcc81a
Added handling of missing aiohttp module 2023-02-12 18:32:20 +00:00
pythongosssss
5d14e9b959
Changed HTTP Server + Added WebSockets
Moved the existing API endpoints to use aoihttp and added websocket notifications
2023-02-12 15:53:48 +00:00
comfyanonymous
7e1e193f39 Automatically enable lowvram mode if vram is less than 4GB.
Use: --normalvram to disable it.
2023-02-10 00:47:56 -05:00
comfyanonymous
534736b924 Add some low vram modes: --lowvram and --novram 2023-02-08 11:37:10 -05:00
comfyanonymous
e3e65947f2 Add a --help to main.py 2023-02-07 22:13:42 -05:00
comfyanonymous
1f18221e17 Add --port to set custom port. 2023-02-07 21:57:17 -05:00
comfyanonymous
3f3d77a324 Fix image node always executing instead of only when the image changed. 2023-02-04 16:08:29 -05:00
comfyanonymous
43c795f462 Add a --listen argument to listen on 0.0.0.0 2023-02-04 12:01:53 -05:00
comfyanonymous
4b08314257 Add more features to the backend queue code.
The queue can now be queried, entries can be deleted and prompts easily
queued to the front of the queue.

Just need to expose it in the UI next.
2023-02-01 22:33:10 -05:00
comfyanonymous
3661e10648 Add a command line option to disable upcasting in some cross attention ops. 2023-01-29 13:12:22 -05:00
comfyanonymous
bc475f86c4 Slightly better errors. 2023-01-26 23:30:29 -05:00
comfyanonymous
eb85896b73 Add code for categories. 2023-01-26 01:26:28 -05:00
comfyanonymous
b9308407b2 Make webui return correct mimetypes for css and js files. 2023-01-24 20:18:16 -05:00
comfyanonymous
a37261bb4b Try to execute the outputs that take the less steps first. 2023-01-22 22:10:13 -05:00
comfyanonymous
9baa48cb33 Add IS_CHANGED method to nodes to check if nodes should be executed again.
LoadImage.IS_CHANGED returns the hash of the image so it will execute again
if the image changed on the disk.
2023-01-22 21:46:16 -05:00
comfyanonymous
220afe3310 Initial commit. 2023-01-16 22:37:14 -05:00