blib-la / runpod-worker-comfy

ComfyUI as a serverless API on RunPod
GNU Affero General Public License v3.0
301 stars 205 forks source link

feat/restore-snapshot #30

Closed kklemon closed 1 week ago

kklemon commented 7 months ago

Motivation

Many users and workflows rely on custom nodes and extensions which correspondingly should also be available in a RunPod worker.

ComfyUI Manager, perhaps the most popular ComfyUI management exension, provides a convenient feature to export a snapshot of the ComfyUI instance with all installed extensions.

This PR implements optional restoring of a snapshot if provided as snapshot.json in the root directory. If such a file is found, ComfyUI Manager will be installed and restoring of the snapshot will be triggered by starting ComfyUI with the --cpu --quick-test-for-ci flags within the Docker image build process.

Issues closed

6 #22 #18 #9 (partially)

Todo

triplecookedchips commented 6 months ago

@kklemon Hi - is it possible to provide a little more guidance here? I added a snapshot.json in the root directory, but nothing changed when I built the image in Docker. Thank you

kklemon commented 6 months ago

Adding a snapshot.json in the root directory should be sufficient. Also, make sure that you are building the image from scratch. Apart from these suggestions, I would need to take a look at the build logs to provide more help.

Edit: Since the Dockerfile uses glob-based file copying, you will need a relatively new Docker installation. I couldn't figure out the exact version, but it should work from Docker version 20 upwards.

triplecookedchips commented 6 months ago

Thanks @kklemon - I didn't build the image from scratch, so will try again with your advice

TimPietrusky commented 6 months ago

@kklemon thanks for adding this, it sounds really nice. We will have to test this, as this is a feature we haven't used yet. But it sounds like this would solve a lot of problems regarding custom nodes and backing them into the actual Docker image.

TimPietrusky commented 5 months ago

@kklemon I updated the base branch as we want to move away from having the dev branch.

TimPietrusky commented 3 months ago

@kklemon ping 🙏

martintomov commented 1 month ago

@TimPietrusky @kklemon I have around 30 custom nodes - what's the best way to install nodes right now? Using the Network Volume where we store models? Have you considered comfy-cli and the node registry?

kklemon commented 4 weeks ago

@TimPietrusky I've completely forgotten about this PR. I will check whether it's still relevant, update it if that's the case or close it otherwise.

kklemon commented 4 weeks ago

@martintomov I haven't been active in the ComfyUI community for a while and don't know what the current de facto standard for managing extensions is, but when I created this PR, I assumed that it's ComfyUI Manager.

If you want to incorporate custom nodes into a RunPod deployment, my recommendation is to install your nodes or extensions via ComfyUI Manager and export a snapshot of your setup as JSON file. You can then just put the snapshot.json in the root directory of this repository, which will be recognized by the build script when building the Docker image. The extensions will be installed during the build process.

TimPietrusky commented 2 weeks ago

@kklemon thank you very much, then I will go down this road and make sure it is working.

TimPietrusky commented 1 week ago

Some changes are coming:

In my tests this made sure, that we can now install custom nodes using the snapshot created using the ComfyUI Manager, which is way more nice than adding the nodes directly into the Dockerfile.

TimPietrusky commented 1 week ago

:tada: This PR is included in version 3.2.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

A-BMT02 commented 1 week ago

I can't seem to get this working . When i start a runpod pod and open my comfy ui on port 8188 it works fine , i can generate my images fine

But when i use the serverless endpoint with the same workflow json , i get an error 2024-11-19 14:00:45.074 [c7msa02ut39p9w] [info] invalid prompt: {'type': 'invalid_prompt', 'message': 'Cannot execute because node FaceDetailer does not exist.',

It seems like the custom nodes are not being recognized in the serverless endpoint even though i have the snapshot.json in the /runpod-volume (/workspace) directory

If i try a request with no custom nodes on the runpod serverless endpoint , it works fine.

TimPietrusky commented 1 week ago

@A-BMT02 I moved this conversation over into an issue: https://github.com/blib-la/runpod-worker-comfy/issues/79