# ComfyUI on Kaggle — Wan 2.2 Image-to-Video Setup A reproducible, automated pipeline to launch **ComfyUI** on free Kaggle GPU instances (T4 / P100 / T4x2) with the **Wan 2.2 Image-to-Video (I2V)** models and a public Cloudflare tunnel. ## 📌 Project Overview This repository contains ready-to-run Jupyter Notebooks optimized for running ComfyUI on Kaggle's cloud environment: - Automated ComfyUI and custom nodes installation - Efficient model downloading via Hugging Face Hub (`huggingface_hub`) - Rapid GGUF-quantized Wan 2.2 model setup for low-VRAM execution - Secure, zero-port-forwarding public access via Cloudflare Tunnel (`cloudflared`) --- ## 📂 Repository Structure ```text ComfyUI_Kaggle/ ├── notebooks/ │ ├── wan-2-2-image-to-video-comfyui-setup-kaggle.ipynb # Main setup notebook (ComfyUI + Models + Tunnel) │ ├── comfyui_wan22_i2v_sfw_debug.ipynb # Debug & dependency verification notebook │ └── wan2_2_kaggle_test.ipynb # Direct script/testing notebook ├── .gitignore # Excludes model weights and generated videos └── README.md # Documentation and setup guide ``` --- ## 🚀 How to Run on Kaggle ### Step 1: Create or Import Notebook 1. Go to [Kaggle](https://www.kaggle.com/) and click **Create** -> **New Notebook**. 2. Click **File** -> **Import Notebook** and upload `notebooks/wan-2-2-image-to-video-comfyui-setup-kaggle.ipynb`. ### Step 2: Configure Kaggle Settings In the notebook sidebar (**Notebook options** on the right): - **Accelerator**: Select **GPU T4 x 2** or **GPU P100**. - **Internet**: Toggle to **On** (required to install packages and download models). ### Step 3: Run the Cells Run the notebook cells in order: 1. **Install ComfyUI & Dependencies**: Clones ComfyUI, installs PyTorch and required packages. 2. **Download Models**: Fetches Wan 2.2 I2V GGUF weights, Clip Vision, VAE, and Text Encoders from Hugging Face into `/kaggle/tmp/ComfyUI/models/`. 3. **Download Cloudflare Tunnel**: Downloads the `cloudflared` Linux binary. 4. **Start ComfyUI**: Launches the server in the background on port `8188`. 5. **Start Tunnel & Open UI**: Launches `cloudflared tunnel` and prints your public URL (e.g., `https://xxxx.trycloudflare.com`). Click the printed URL to open the full ComfyUI web interface in your browser. --- ## 📦 Models Used | Component | Repository | Filename / Path | | :--- | :--- | :--- | | **I2V UNet (GGUF)** | `befox/WAN2.2-14B-Rapid-AllInOne-GGUF` | `v10/wan2.2-i2v-rapid-aio-v10-nsfw-Q4_K.gguf` | | **Clip Vision** | `Comfy-Org/Wan_2.1_ComfyUI_repackaged` | `split_files/clip_vision/clip_vision_h.safetensors` | | **VAE** | `Comfy-Org/Wan_2.2_ComfyUI_Repackaged` | `split_files/vae/wan_2.1_vae.safetensors` | | **Text Encoder** | `Comfy-Org/Wan_2.1_ComfyUI_repackaged` | `split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors` | --- ## 🔒 Security & Best Practices - Model weights (`.gguf`, `.safetensors`) and generated output videos (`.mp4`) are gitignored to keep the repository lightweight. - Sensitive access tokens should never be committed into the notebook cells. Use Kaggle Secrets (`from kaggle_secrets import UserSecretsClient`) if private Hugging Face tokens are required.