/ComfyUI-Colab-Notebook

A comprehensive Google Colab notebook for running ComfyUI with advanced features for storage, model management, and remote access.

Primary LanguageJupyter Notebook

🚀 ComfyUI on Google Colab: Advanced & Flexible Deployment

image

Visitors    Open In Colab

✨ Overview

This Google Colab notebook provides a comprehensive and highly configurable environment for deploying and running ComfyUI, a powerful node-based interface for Stable Diffusion. Designed for efficiency and scalability, this setup offers robust features for managing models, custom nodes, and remote access, making it suitable for both rapid prototyping and sustained AI art generation.

Key Features:

  • 💻 Live Command Center: A rich, real-time dashboard to monitor every aspect of your session, including GPU/CPU/RAM utilization, VRAM usage, server status, and a detailed event log.
  • 💾 Hybrid Storage System: A sophisticated SAVE_TO_GDRIVE toggle allows you to choose your storage strategy. Save everything to Google Drive for persistence, or offload large models to Colab's temporary storage to conserve Drive space.
  • 📥 Universal Asset Downloader: A powerful, all-in-one downloader that intelligently handles links from Civitai, Hugging Face, and MEGA. It automatically detects asset types from Civitai image pages and downloads all required models and LoRAs.
  • 🎥 Specialized WAN/FLUX Model Support: Dedicated downloader cells for complex video and flow-based models like WAN 2.2 and FLUX, ensuring all components are placed in the correct directories.
  • 🔌 Persistent Custom Nodes: Install and manage a vast ecosystem of custom nodes with a single click. All nodes are saved to your Google Drive, ensuring they persist across all your sessions.
  • 🌐 Secure Remote Access: Integrated Ngrok support generates a secure, public URL, allowing you to access and control your ComfyUI instance from any browser, anywhere.
  • ⚙️ Effortless Configuration: A clean, centralized configuration panel for all your API keys (Civitai, Hugging Face) and settings, including Colab Secrets support for enhanced security.
image

💾 Storage Configuration

The notebook’s SAVE_TO_GDRIVE setting controls your storage strategy:

  • SAVE_TO_GDRIVE = True All data — including models, nodes, inputs, and outputs — are saved persistently in your Google Drive folder (GDRIVE_BASE). This ensures no need to re-download models after reconnecting.

  • SAVE_TO_GDRIVE = False Only essential user data and configurations are saved to Google Drive. Large models are stored temporarily on Colab’s runtime storage. This saves Drive space but requires model re-download each session.

    image

⚙️ Usage Instructions

1. Runtime Setup

  • Go to Runtime > Change runtime type in Colab.
  • Select GPU accelerator (T4 or A100 recommended).

2. Configure Settings

In the "Enhanced ComfyUI User Configuration" cell, set:

  • SAVE_TO_GDRIVE (True/False)
  • GDRIVE_BASE (path in your Google Drive)
  • API tokens for Hugging Face (HF_TOKEN), Civitai (CIVITAI_API_KEY), and Ngrok (NGROK_AUTHTOKEN)
  • Optional: FORCE_MODEL_REFRESH to re-download models

3. Environment Setup

Run sequentially:

  • Install Dependencies & Setup ComfyUI: Installs system/Python packages and clones ComfyUI repo.
  • Google Drive Integration & Path Config: Mounts Drive, creates directories, and configures model paths.

4. Manage Models & Nodes

  • Use the Universal Asset Downloader to fetch assets via URLs (Civitai, Hugging Face, MEGA).
  • Download WAN models, Hugging Face models, or Civitai checkpoints/LoRAs from curated lists.
  • Install custom nodes, including ComfyUI-Manager and popular extensions, with persistence.

5. (Optional) Remote Access Setup

Run the Ngrok setup cell if remote access is required (ensure NGROK_AUTHTOKEN is set).

6. Launch ComfyUI

Run the launch cell to:

  • Start ComfyUI server
  • Enable live resource monitoring
  • Access via local URL and public Ngrok URL (if configured)

📥 Importing Custom Workflows

To extend functionality, import JSON workflow files:

  1. Download or save a workflow .json file.
  2. Open your ComfyUI web interface.
  3. Use the "Load" button to import the workflow into your node graph.

❤️ Like the tool? Give it a ⭐ on GitHub or share the notebook. Happy creating!