Run ComfyUI on Modal with auto-scaling, GPU snapshots, and easy model management.
Good for testing wan2.2 or other video generation models.
- A Modal account
- Python installed
uvinstalled
- Clone this repository.
- Install the Modal client:
uv sync
- Set up your modal account (if not done already):
modal setup
Copy models.example.py to models.py and edit it to manage your models. You can specify:
- Hugging Face models(
models) usingrepo_idandfilename. - External models(
models_ext, e.g. civitai) using a directurl.
Models are downloaded to volumes and symlinked to the specified model_dir.
See models.example.py for reference.
Copy plugins.example.py to plugins.py and edit it to add custom node IDs or titles to be installed via comfy-cli.
- Workflow Dependencies: If you have a
workflow_api.jsonin the root directory, the setup will automatically install the necessary custom nodes for that workflow.
Open ComfyUI manager on comfyui and click "Used in Workflow" to see which custom nodes are used in the workflow.
Add these custom nodes to plugins.py(be careful of node id).
Run the following command to start ComfyUI in development mode:
modal serve comfyui.pyThis will provide a temporary URL where you can access the ComfyUI interface.
To deploy ComfyUI as a persistent app:
modal deploy comfyui.py- Auto-scaling: Scales down to zero when not in use to save costs.
- GPU Snapshots: Fast startup times using Modal's GPU snapshots.
- Model Caching: Uses Modal Volumes to cache models across runs.
- Custom Node Management: Integrated with
comfy-clifor easy plugin installation.
Please feel free to contribute to make this project better. Performance improvements/optimizations are very welcome.