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

A comprehensive toolkit for reliably locking, packing and deploying environments for ComfyUI workflows.

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

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.1%) to scientific vocabulary

Keywords

ai-art comfyui comfyui-api comfyui-manager comfyui-nodes comfyui-workflow genai

Keywords from Contributors

mlops llm-inference llmops llm-serving multimodal vicuna openllm open-source-llm model-inference mistral
Last synced: 5 months ago · JSON representation

Repository

A comprehensive toolkit for reliably locking, packing and deploying environments for ComfyUI workflows.

Basic Info
  • Host: GitHub
  • Owner: bentoml
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 522 KB
Statistics
  • Stars: 176
  • Watchers: 8
  • Forks: 25
  • Open Issues: 12
  • Releases: 0
Topics
ai-art comfyui comfyui-api comfyui-manager comfyui-nodes comfyui-workflow genai
Created over 1 year ago · Last pushed 6 months ago
Metadata Files
Readme License

README.md

Comfy-Pack: Making ComfyUI Workflows Shareable

banner2

comfy-pack is 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

ComfyUI Manager is great for find missing custom nodes. But when sharing ComfyUI workflows to others(your audience or team members), you've still likely heard these responses:

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

These are fundamental challenges in workflow sharing – every component should match exactly: custom nodes, model files, and Python dependencies. Modern pacakge managers like npm and poetry introduced "lock" feature, which means record the exact version for every requirement. ComfyUI Manager isn't designed for that.

We learned it from our community and developed comfy-pack to address these problems. 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:

bash comfy-pack unpack workflow.cpack.zip

This means you can focus on your creative work while comfy-pack handles the rest.

Usages

Installation

We recommend you use ComfyUI Manager to install comfy-pack. Simply search for comfy-pack and click Install. Restart the server and refresh your ComfyUI interface to apply changes.

install_node

Alternatively, clone the project repository through git.

bash cd ComfyUI/custom_nodes git clone https://github.com/bentoml/comfy-pack.git

To install the comfy-pack CLI, run:

bash pip install comfy-pack

Pack a ComfyUI workflow and its environment

You can package a workflow and the environment required to run the workflow into an artifact that can be unpacked elsewhere.

  1. Click the Package button to create a .cpack.zip artifact.
  2. (Optional) Select the models that you want to include (only model hash will be recorded, so you won't get a 100GB zip file).

pack

Unpack the ComfyUI environments

Unpacking a .cpack.zip artifact will restore the ComfyUI environment for the workflow. During unpacking, comfy-pack will perform the following steps.

  1. Prepare a Python virtual environment with the exact packages used to run the workflow.
  2. Clone ComfyUI and custom nodes from the exact revisions required by the workflow.
  3. Search for and download models from common registries like Hugging Face and Civitai. Unpacking workflows using the same model will not cause the model to be downloaded multiple times. Instead, model weights will be symbolically linked.

To unpack:

bash comfy-pack unpack workflow.cpack.zip

Huggingface gated models can be accessed by setting your HF_TOKEN as an environment variable before unpacking:

bash export HF_TOKEN=hf_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx comfy-pack unpack workflow.cpack.zip

For example cpack files, check our examples folder.

Deploy a workflow as an API

You can turn a ComfyUI workflow into an API endpoint callable using any clients through HTTP.

1. Annotate input & output Use custom nodes provided by comfy-pack to annotate the fields to be used as input and output parameters. To add a comfy-pack node, right-click and select **Add Node** > **ComfyPack** > **output/input** > [Select a type] Input nodes: - ImageInput: Accepts `image` type input, similar to the official `LoadImage` node - StringInput: Accepts `string` type input (e.g., prompts) - IntInput: Accepts `int` type input (e.g., dimensions, seeds) - AnyInput: Accepts `combo` type and more input (e.g., custom nodes) ![input](https://github.com/user-attachments/assets/44264007-0ac8-4e23-8dc0-e60aa0ebcea2) Output nodes: - ImageOutput: Outputs `image` type, similar to the official `SaveImage` node - FileOutput: Outputs file path as `string` type and saves the file under that path ![output](https://github.com/user-attachments/assets/a4526661-8930-4575-bacc-33b6887f6271) More field types are under way.
2. Serve the workflow Start an HTTP server at `http://127.0.0.1:3000` (default) to serve the workflow under the `/generate` path. ![serve](https://github.com/user-attachments/assets/8d4c92c5-d6d7-485e-bc71-e4fc0fe8bf35) You can call the `/generate` endpoint by specifying parameters configured through your comfy-pack nodes, such as prompt, width, height, and seed. > [!NOTE] > The name of a comfy-pack node is the parameter name used for API calls. Examples to call the endpoint: CURL ```bash curl -X 'POST' \ 'http://127.0.0.1:3000/generate' \ -H 'accept: application/octet-stream' \ -H 'Content-Type: application/json' \ -d '{ "prompt": "rocks in a bottle", "width": 512, "height": 512, "seed": 1 }' ``` BentoML client Under the hood, comfy-pack leverages [BentoML](https://github.com/bentoml/BentoML), the unified model serving framework. You can invoke the endpoint using [the BentoML Python client](https://docs.bentoml.com/en/latest/build-with-bentoml/clients.html): ```python import bentoml with bentoml.SyncHTTPClient("http://127.0.0.1:3000") as client: result = client.generate( prompt="rocks in a bottle", width=512, height=512, seed=1 ) ```
3. (Optional) Pack the workflow and environment Pack the workflow and environment into an artifact that can be unpacked elsewhere to recreate the workflow. ```bash # 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 the cloud Deploy to [BentoCloud](https://www.bentoml.com/) with access to a variety of GPUs and blazing fast scaling. Follow [the instructions here](https://docs.bentoml.com/en/latest/scale-with-bentocloud/manage-api-tokens.html) to get your BentoCloud access token. If you don’t have a BentoCloud account, you can [sign up for free](https://bentoml.com/). ![image](https://github.com/user-attachments/assets/1ffa31fc-1f50-4ea7-a47e-7dae3b874273)

Security Guidelines

A cpack file only contains the metadata of the workflow environment, such as Python package versions, ComfyUI and custom node revisions, and model hashes. It does not contain any sensitive information like API keys, passwords, or user data. However, unpacking a cpack file will install custom nodes and Python dependencies. It is recommended to unpack cpack files from trusted sources.

comfy-pack has a strict mode for unpacking. You can enable it by setting the CPACK_STRICT_MODE environment variable to true. It will sacrifice some flexibility and compatibility for security. For now, comfy-pack will:

  • Use more strict index strategy in Python package installation

More security features are under way.

Roadmap

This project is under active development. Currently we are working on:

  • Enhanced user experience
  • Docker support
  • Local .cpack file management with version control
  • Enhanced service capabilities

Community

comfy-pack is actively maintained by the BentoML team. Feel free to reach out 👉 Join our Slack community!

Contributing

As an open-source project, we welcome contributions of all kinds, such as new features, bug fixes, and documentation. Here are some of the ways to contribute:

Owner

  • Name: BentoML
  • Login: bentoml
  • Kind: organization
  • Location: San Francisco

The most flexible way to serve AI models in production

GitHub Events

Total
  • Create event: 55
  • Issues event: 30
  • Release event: 19
  • Watch event: 145
  • Delete event: 33
  • Member event: 1
  • Issue comment event: 41
  • Push event: 177
  • Pull request review comment event: 5
  • Pull request review event: 13
  • Pull request event: 90
  • Fork event: 21
Last Year
  • Create event: 55
  • Issues event: 30
  • Release event: 19
  • Watch event: 145
  • Delete event: 33
  • Member event: 1
  • Issue comment event: 41
  • Push event: 177
  • Pull request review comment event: 5
  • Pull request review event: 13
  • Pull request event: 90
  • Fork event: 21

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 243
  • Total Committers: 8
  • Avg Commits per committer: 30.375
  • Development Distribution Score (DDS): 0.416
Past Year
  • Commits: 243
  • Committers: 8
  • Avg Commits per committer: 30.375
  • Development Distribution Score (DDS): 0.416
Top Committers
Name Email Commits
bojiang b****_@o****m 142
Frost Ming me@f****m 88
Zhao Shenyang d****v@z****m 4
Sean Sheng s****g@g****m 3
Sherlock113 s****7@g****m 2
agent a****t@S****l 2
Jonas Z. 6****H 1
Ikko Eltociear Ashimine e****r@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 22
  • Total pull requests: 85
  • Average time to close issues: 5 days
  • Average time to close pull requests: about 15 hours
  • Total issue authors: 19
  • Total pull request authors: 9
  • Average comments per issue: 1.23
  • Average comments per pull request: 0.04
  • Merged pull requests: 76
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 22
  • Pull requests: 85
  • Average time to close issues: 5 days
  • Average time to close pull requests: about 15 hours
  • Issue authors: 19
  • Pull request authors: 9
  • Average comments per issue: 1.23
  • Average comments per pull request: 0.04
  • Merged pull requests: 76
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • aaronsantiago (3)
  • mrdrprofuroboros (2)
  • Kosinkadink (1)
  • wbcmthh42 (1)
  • sanderjson (1)
  • bhowiebkr (1)
  • Aries2003 (1)
  • kdcyberdude (1)
  • HighAsset (1)
  • GigaDroid (1)
  • Sarthak-999 (1)
  • emjay07 (1)
  • ggarone-ptb (1)
  • yllucsyeoj (1)
  • dapa5900 (1)
Pull Request Authors
  • frostming (49)
  • bojiang (26)
  • sebastianelsner (6)
  • larme (4)
  • BlackhawkZZH (2)
  • Sherlock113 (2)
  • eltociear (2)
  • ssheng (1)
  • aaronsantiago (1)
Top Labels
Issue Labels
bug (1)
Pull Request Labels
documentation (2)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 339 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 18
  • Total maintainers: 1
pypi.org: comfy-pack

A comprehensive toolkit for standardizing, packaging and deploying ComfyUI workflows as reproducible environments and production-ready REST services

  • Versions: 18
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 339 Last month
Rankings
Dependent packages count: 9.9%
Average: 32.8%
Dependent repos count: 55.7%
Maintainers (1)
Last synced: 6 months ago