Files
bentoml-comfy-pack/README.md
T
2024-12-19 10:03:10 +08:00

4.2 KiB
Raw Blame History

Comfy-Pack: Package and Deploy ComfyUI Workflows

banner

A comprehensive toolkit for reliably packing and unpacking environments for ComfyUI workflows.

  • 📦 Pack workflow environments as artifacts: Saves the workflow environment in a .cpack.zip artifact with Python package versions, ComfyUI and custom node revisions, and model hashes.
  • ✨ Unpack artifacts to recreate workflow environments: Unpacks the .cpack.zip artifact to recreate the same environment with the exact Python package versions, ComfyUI and custom node revisions, and model weights.
  • 🚀 Deploy workflows as APIs: Deploys the workflow as a RESTful API with customizable input and output parameters.

Motivations

When sharing ComfyUI workflows to others, your audiences or team member, you've likely heard these responses:

  • "Custom Node not found"
  • "Cannot find the model file"
  • "Missing Python dependencies"

These are fundamental challenges in workflow sharing – every component must match exactly: custom nodes, model files, and Python dependencies.

We learned it from our communit, and developed Comfy-Pack to address this directly. With a single click, it captures and locks your entire workflow environment into a .cpack.zip file, including Python packages, custom nodes, model hashes, and required assets.

Users can recreate the exact environment with one command:

comfy-pack unpack workflow.cpack.zip

Focus on creating. Let Comfy-Pack handle the rest.

Usages

Installation

Search comfy-pack in ComfyUI Manager (Recommended)

install_node

or install from Git:

git clone https://github.com/bentoml/comfy-pack.git

📦 Pack a ComfyUI workflow and its environment

  1. Click "Package" button to create .cpack.zip
  2. (Optional) select the models that you want to include (only model hash will be recorded, so you wont get a 100GB zip file) pack

✨ Unpack the ComfyUI environments

comfy-pack unpack workflow.cpack.zip

For example cpack files, check our examples folder.

🏗️ Install the newest ComfyUI & init a project from sketch

comfy-pack init

🚀 Deploy a workflow as an API

1. annotate input & output

input

output

2. serve and test locally

serve

3. (Optional) pack & run anywhere
# Get the workflow input spec
comfy-pack run workflow.cpack.zip --help

# Run
comfy-pack run workflow.cpack.zip --src-image image.png --video video.mp4
4. (Optional) deploy to cloud *

image

Custom Node List

ComfyPack provides custom nodes for standardizing inputs:

  • ImageInput: provides image type input, similar to official LoadImage node
  • StringInput: provides string type input, nice for prompts
  • IntInput: provides int type input, suitable for size or seeds
  • AnyInput: provides combo type and more input, suitable for custom nodes
  • ImageOutput: takes image type inputs, similar to official SaveImage node, take an image of a bunch of images
  • FileOutput: takes file path as string type, save and output the file under that path
  • ...

These nodes help define clear interfaces for your workflow.

🚀 Roadmap

This project is under active development.

  • better UX
  • Docker Support
  • local cpack manager and Version Control
  • Enhanced service capabilities

License

Apache 2.0

Community

  • Issues & Feature Requests: GitHub Issues
  • Questions & Discussion: Discord Server

Detailed documentation: under development