[![image](https://img.shields.io/discord/772774097734074388?label=Discord&logo=discord)](https://discord.com/servers/software-engineering-courses-secourses-772774097734074388) [![Hits](https://hits.sh/github.com/FurkanGozukara/Stable-Diffusion/blob/main/Tutorials/How-To-Use-ComfyUI-On-Your-PC-On-RunPod-On-Colab-With-SDXL.md.svg?style=plastic&label=Hits%20Since%2025.08.27&labelColor=007ec6&logo=SECourses)](https://hits.sh/github.com/FurkanGozukara/Stable-Diffusion/blob/main/Tutorials/How-To-Use-ComfyUI-On-Your-PC-On-RunPod-On-Colab-With-SDXL.md) 

[![Patreon](https://img.shields.io/badge/Patreon-Support%20Me-F2EB0E?style=for-the-badge&logo=patreon)](https://www.patreon.com/c/SECourses) [![BuyMeACoffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-ffdd00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/DrFurkan) [![Furkan Gözükara Medium](https://img.shields.io/badge/Medium-Follow%20Me-800080?style=for-the-badge&logo=medium&logoColor=white)](https://medium.com/@furkangozukara) [![Codio](https://img.shields.io/static/v1?style=for-the-badge&message=Articles&color=4574E0&logo=Codio&logoColor=FFFFFF&label=CivitAI)](https://civitai.com/user/SECourses/articles) [![Furkan Gözükara Medium](https://img.shields.io/badge/DeviantArt-Follow%20Me-990000?style=for-the-badge&logo=deviantart&logoColor=white)](https://www.deviantart.com/monstermmorpg)

[![YouTube Channel](https://img.shields.io/badge/YouTube-SECourses-C50C0C?style=for-the-badge&logo=youtube)](https://www.youtube.com/SECourses)  [![Furkan Gözükara LinkedIn](https://img.shields.io/badge/LinkedIn-Follow%20Me-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/furkangozukara/)   [![Udemy](https://img.shields.io/static/v1?style=for-the-badge&message=Stable%20Diffusion%20Course&color=A435F0&logo=Udemy&logoColor=FFFFFF&label=Udemy)](https://www.udemy.com/course/stable-diffusion-dreambooth-lora-zero-to-hero/?referralCode=E327407C9BDF0CEA8156) [![Twitter Follow Furkan Gözükara](https://img.shields.io/badge/Twitter-Follow%20Me-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/GozukaraFurkan)

# [Tutorial] How To Use ComfyUI On Your PC, On Google Colab (Free) And On RunPod With SDXL Full Tutorial / Guide
## Tutorial Video link > [ComfyUI Master Tutorial - Stable Diffusion XL (SDXL) - Install On PC, Google Colab (Free) & RunPod](https://youtu.be/FnMHbhvWUhE)

* ComfyUI Github Repo : https://github.com/comfyanonymous/ComfyUI
* RunPod template name : RunPod SD Comfy UI
* Download attached images, drag and drop (or use Load button) them into ComfyUI for workflows to load. Images have embedding info
* The URL it will start by default : http://127.0.0.1:8188/

### SDXL 1.0 Workflows below

* [SDXL_1_0](https://github.com/FurkanGozukara/Stable-Diffusion/assets/19240467/252a2683-5ca1-440a-9050-b8cc2cb03ceb) (right click and save as) workflow has the SDXL setup with refiner with best settings. Working amazing.
* [SDXL img2img](https://github.com/FurkanGozukara/Stable-Diffusion/assets/19240467/8e8e36dd-db64-4f93-ae4e-1cba39b6409a) This is img2img with SDXL + Refiner
* [SDXL_1_0_LoRA_InPAINT](https://github.com/FurkanGozukara/Stable-Diffusion/assets/19240467/aef39ad8-2594-46d1-b44c-de8667b090d6) | [SDXL_1_0_With_LoRA](https://github.com/FurkanGozukara/Stable-Diffusion/assets/19240467/b728a3b9-b9d5-44e0-9d7e-6b22e1c54e35) | [SDXL_1_0_Inpaint](https://github.com/FurkanGozukara/Stable-Diffusion/assets/19240467/a66357dd-32f0-444e-ba89-274a3b04313b) | [SDXL_1_0_Refiner_Inpaint](https://github.com/FurkanGozukara/Stable-Diffusion/assets/19240467/b1cd8b1f-5128-4f04-90e8-f27b7fd5ef9d)

* Tutorial Video : [ComfyUI Master Tutorial - Stable Diffusion XL (SDXL) - Install On PC, Google Colab (Free) & RunPod](https://youtu.be/FnMHbhvWUhE)


### SDXL 0.9 Workflows below. Use SDXL 1.0 much better
* [SDXL_1](https://github.com/FurkanGozukara/Stable-Diffusion/assets/19240467/30bc9a89-fd0f-4f07-bdcf-c2e12485db15) (right click and save as) workflow has the SDXL setup with refiner with best settings. Working amazing. [Here Screenshot](https://cdn-uploads.huggingface.co/production/uploads/6345bd89fe134dfd7a0dba40/SyUZbhotUgR2qOP0OQ678.png)
* [SDXL_LoRA_InPAINT](https://github.com/FurkanGozukara/Stable-Diffusion/assets/19240467/6c837b3d-fa62-44cb-8582-7b3cb8c5d513) | [SDXL_With_LoRA](https://github.com/FurkanGozukara/Stable-Diffusion/assets/19240467/b4cad1c3-a779-4d08-b414-fd51345ff320) | [SDXL_Inpaint](https://github.com/FurkanGozukara/Stable-Diffusion/assets/19240467/887ab302-98db-4df3-992e-fc7be991f905) | [SDXL_Refiner_Inpaint](https://github.com/FurkanGozukara/Stable-Diffusion/assets/19240467/c2ae4046-875e-43da-869a-f111bbb0c34d)

* Tutorial Video : [ComfyUI Master Tutorial - Stable Diffusion XL (SDXL) - Install On PC, Google Colab (Free) & RunPod](https://youtu.be/FnMHbhvWUhE)


## General Resources About ComfyUI

* Examples : https://comfyanonymous.github.io/ComfyUI_examples/
* Shortcuts : https://github.com/comfyanonymous/ComfyUI#shortcuts
* Winrar to open 7-zip file : https://www.rarlab.com/download.htm
* Best VAE File : https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.ckpt
* Realistic Vision V4 : https://huggingface.co/SG161222/Realistic_Vision_V4.0/resolve/main/Realistic_Vision_V4.0.safetensors

## PC ComfyUI Installation

* Windows download link : https://github.com/comfyanonymous/ComfyUI#windows

### SDXL 1.0 Released. No need Hugging Face account anymore. Below direct download links
* SDXL 1.0 base model direct link
* * https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors
* SDXL 1.0 refiner model direct link
* * https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0.safetensors  

## Google Colab (Free) ComfyUI Installation

* [Colab Link](https://github.com/FurkanGozukara/Stable-Diffusion/blob/main/ColabNotebooks/comfyui_SDXL_colab.ipynb)
* Download generated images code (shown in tutorial) : https://www.patreon.com/posts/runpod-comfyui-86062569

## RunPod ComfyUI Installation

### Register or Login Runpod : https://bit.ly/RunPodIO

* How to use RunPod master tutorial including runpodctl
* [Ultimate RunPod Tutorial For Stable Diffusion - Automatic1111 - Data Transfers, Extensions, CivitAI](https://youtu.be/QN1vdGhjcRc)

* Select RunPod Fast Stable Diffusion template and start your pod

### Auto Install

* Download comfy_ui.sh from here: https://www.patreon.com/posts/runpod-comfyui-86062569
* Upload comfy_ui.sh into workspace folder
* Execute below command and wait until all is done

```
chmod +x comfy_ui.sh
./comfy_ui.sh
```

**For running it after install run below command and use 3001 connect button on MyPods interface**
* If it doesn't start at the first time execute again

```
apt update
apt install psmisc
fuser -k 3000/tcp
cd /workspace/ComfyUI/venv
source bin/activate
cd /workspace/ComfyUI
python main.py --listen 0.0.0.0 --port 3000
```

### Manual Step by Step Install

* Execute below commands 1 by 1
* Move into workspace and start a new terminal

```
git clone https://github.com/comfyanonymous/ComfyUI
```

Move into ComfyUI and start a new terminal

```
python -m venv venv
```

* Move into venv and start a new terminal

```
source bin/activate
```

```
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
```

```
pip install -U --pre xformers
```

```
cd ..
```

```
pip install -r requirements.txt
```

* Move into models/vae/ and start a new terminal

```
wget https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors
```

* Move into models/checkpoints and start a new terminal

```
wget https://huggingface.co/SG161222/Realistic_Vision_V4.0/resolve/main/Realistic_Vision_V4.0.safetensors
```

### SDXL 1.0 Released. No need Hugging Face account anymore. Below direct download links
* SDXL 1.0 base model direct link
* * https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors
* SDXL 1.0 refiner model direct link
* * https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0.safetensors  

### How To Run After Install

* Run below command and then use port 3001 connect button on MyPods section of the RunPod.io website
* If it doesn't start at the first time execute again
```
apt update
apt install psmisc
fuser -k 3000/tcp
cd /workspace/ComfyUI/venv
source bin/activate
cd /workspace/ComfyUI
python main.py --listen 0.0.0.0 --port 3000
```


