ComfyUI-to-Python-Extension icon indicating copy to clipboard operation
ComfyUI-to-Python-Extension copied to clipboard

Feature: enable pre-loading checkpoints into memory and executing workflow with different parameters fast

Open vojtajina opened this issue 9 months ago • 1 comments

I think it would be useful to be able to run the generated workflow repeatedly, without re-loading everything into memory every single time. For instance, one could use it as API server which is running, the model loaded in memory and thus respond to different prompts (or other parameters) very fast. ComfyUI works that way (I think): it only recomputes nodes that changed.

I tried to change the generated code a bit, ie. wrap it in a class and keep checkpointloadersimple_4 etc as instance variables, and add method to run the workflow using these already instantiated objects, but it seems like every call to KSSampler.sample still re-loads everything into memory and it's not any faster.

Any ideas how to do that? (I would be happy to send a PR)

vojtajina avatar May 02 '24 18:05 vojtajina