1+ {
2+ "cells" : [
3+ {
4+ "cell_type" : " markdown" ,
5+ "metadata" : {
6+ "id" : " aaaaaaaaaa"
7+ },
8+ "source" : [
9+ " Git clone the repo and install the requirements. (ignore the pip errors about protobuf)"
10+ ]
11+ },
12+ {
13+ "cell_type" : " code" ,
14+ "execution_count" : null ,
15+ "metadata" : {
16+ "id" : " bbbbbbbbbb"
17+ },
18+ "outputs" : [],
19+ "source" : [
20+ " #@title Environment Setup\n " ,
21+ " \n " ,
22+ " \n " ,
23+ " OPTIONS = {}\n " ,
24+ " \n " ,
25+ " USE_GOOGLE_DRIVE = False #@param {type:\" boolean\" }\n " ,
26+ " UPDATE_COMFY_UI = True #@param {type:\" boolean\" }\n " ,
27+ " WORKSPACE = 'ComfyUI'\n " ,
28+ " OPTIONS['USE_GOOGLE_DRIVE'] = USE_GOOGLE_DRIVE\n " ,
29+ " OPTIONS['UPDATE_COMFY_UI'] = UPDATE_COMFY_UI\n " ,
30+ " \n " ,
31+ " if OPTIONS['USE_GOOGLE_DRIVE']:\n " ,
32+ " !echo \" Mounting Google Drive...\"\n " ,
33+ " %cd /\n " ,
34+ " \n " ,
35+ " from google.colab import drive\n " ,
36+ " drive.mount('/content/drive')\n " ,
37+ " \n " ,
38+ " WORKSPACE = \" /content/drive/MyDrive/ComfyUI\"\n " ,
39+ " %cd /content/drive/MyDrive\n " ,
40+ " \n " ,
41+ " ![ ! -d $WORKSPACE ] && echo -= Initial setup ComfyUI =- && git clone https://github.com/comfyanonymous/ComfyUI\n " ,
42+ " %cd $WORKSPACE\n " ,
43+ " \n " ,
44+ " if OPTIONS['UPDATE_COMFY_UI']:\n " ,
45+ " !echo -= Updating ComfyUI =-\n " ,
46+ " !git pull\n " ,
47+ " \n " ,
48+ " !echo -= Install dependencies =-\n " ,
49+ " !pip install xformers!=0.0.18 -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu121 --extra-index-url https://download.pytorch.org/whl/cu118 --extra-index-url https://download.pytorch.org/whl/cu117"
50+ ]
51+ },
52+ {
53+ "cell_type" : " markdown" ,
54+ "metadata" : {
55+ "id" : " cccccccccc"
56+ },
57+ "source" : [
58+ " Download some models/checkpoints/vae or custom comfyui nodes (uncomment the commands for the ones you want)"
59+ ]
60+ },
61+ {
62+ "cell_type" : " code" ,
63+ "execution_count" : null ,
64+ "metadata" : {
65+ "id" : " dddddddddd"
66+ },
67+ "outputs" : [],
68+ "source" : [
69+ " # Checkpoints\n " ,
70+ " \n " ,
71+ " ### SDXL\n " ,
72+ " ### I recommend these workflow examples: https://comfyanonymous.github.io/ComfyUI_examples/sdxl/\n " ,
73+ " \n " ,
74+ " #!wget -c https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors -P ./models/checkpoints/\n " ,
75+ " #!wget -c https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0.safetensors -P ./models/checkpoints/\n " ,
76+ " \n " ,
77+ " # SDXL ReVision\n " ,
78+ " #!wget -c https://huggingface.co/comfyanonymous/clip_vision_g/resolve/main/clip_vision_g.safetensors -P ./models/clip_vision/\n " ,
79+ " \n " ,
80+ " # SD1.5\n " ,
81+ " !wget -c https://huggingface.co/Comfy-Org/stable-diffusion-v1-5-archive/resolve/main/v1-5-pruned-emaonly-fp16.safetensors -P ./models/checkpoints/\n " ,
82+ " \n " ,
83+ " # SD2\n " ,
84+ " #!wget -c https://huggingface.co/stabilityai/stable-diffusion-2-1-base/resolve/main/v2-1_512-ema-pruned.safetensors -P ./models/checkpoints/\n " ,
85+ " #!wget -c https://huggingface.co/stabilityai/stable-diffusion-2-1/resolve/main/v2-1_768-ema-pruned.safetensors -P ./models/checkpoints/\n " ,
86+ " \n " ,
87+ " # Some SD1.5 anime style\n " ,
88+ " #!wget -c https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/Models/AbyssOrangeMix2/AbyssOrangeMix2_hard.safetensors -P ./models/checkpoints/\n " ,
89+ " #!wget -c https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/Models/AbyssOrangeMix3/AOM3A1_orangemixs.safetensors -P ./models/checkpoints/\n " ,
90+ " #!wget -c https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/Models/AbyssOrangeMix3/AOM3A3_orangemixs.safetensors -P ./models/checkpoints/\n " ,
91+ " #!wget -c https://huggingface.co/Linaqruf/anything-v3.0/resolve/main/anything-v3-fp16-pruned.safetensors -P ./models/checkpoints/\n " ,
92+ " \n " ,
93+ " # Waifu Diffusion 1.5 (anime style SD2.x 768-v)\n " ,
94+ " #!wget -c https://huggingface.co/waifu-diffusion/wd-1-5-beta3/resolve/main/wd-illusion-fp16.safetensors -P ./models/checkpoints/\n " ,
95+ " \n " ,
96+ " \n " ,
97+ " # unCLIP models\n " ,
98+ " #!wget -c https://huggingface.co/comfyanonymous/illuminatiDiffusionV1_v11_unCLIP/resolve/main/illuminatiDiffusionV1_v11-unclip-h-fp16.safetensors -P ./models/checkpoints/\n " ,
99+ " #!wget -c https://huggingface.co/comfyanonymous/wd-1.5-beta2_unCLIP/resolve/main/wd-1-5-beta2-aesthetic-unclip-h-fp16.safetensors -P ./models/checkpoints/\n " ,
100+ " \n " ,
101+ " \n " ,
102+ " # VAE\n " ,
103+ " !wget -c https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors -P ./models/vae/\n " ,
104+ " #!wget -c https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/VAEs/orangemix.vae.pt -P ./models/vae/\n " ,
105+ " #!wget -c https://huggingface.co/hakurei/waifu-diffusion-v1-4/resolve/main/vae/kl-f8-anime2.ckpt -P ./models/vae/\n " ,
106+ " \n " ,
107+ " \n " ,
108+ " # Loras\n " ,
109+ " #!wget -c https://civitai.com/api/download/models/10350 -O ./models/loras/theovercomer8sContrastFix_sd21768.safetensors #theovercomer8sContrastFix SD2.x 768-v\n " ,
110+ " #!wget -c https://civitai.com/api/download/models/10638 -O ./models/loras/theovercomer8sContrastFix_sd15.safetensors #theovercomer8sContrastFix SD1.x\n " ,
111+ " #!wget -c https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_offset_example-lora_1.0.safetensors -P ./models/loras/ #SDXL offset noise lora\n " ,
112+ " \n " ,
113+ " \n " ,
114+ " # T2I-Adapter\n " ,
115+ " #!wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_depth_sd14v1.pth -P ./models/controlnet/\n " ,
116+ " #!wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_seg_sd14v1.pth -P ./models/controlnet/\n " ,
117+ " #!wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_sketch_sd14v1.pth -P ./models/controlnet/\n " ,
118+ " #!wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_keypose_sd14v1.pth -P ./models/controlnet/\n " ,
119+ " #!wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_openpose_sd14v1.pth -P ./models/controlnet/\n " ,
120+ " #!wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_color_sd14v1.pth -P ./models/controlnet/\n " ,
121+ " #!wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_canny_sd14v1.pth -P ./models/controlnet/\n " ,
122+ " \n " ,
123+ " # T2I Styles Model\n " ,
124+ " #!wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_style_sd14v1.pth -P ./models/style_models/\n " ,
125+ " \n " ,
126+ " # CLIPVision model (needed for styles model)\n " ,
127+ " #!wget -c https://huggingface.co/openai/clip-vit-large-patch14/resolve/main/pytorch_model.bin -O ./models/clip_vision/clip_vit14.bin\n " ,
128+ " \n " ,
129+ " \n " ,
130+ " # ControlNet\n " ,
131+ " #!wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11e_sd15_ip2p_fp16.safetensors -P ./models/controlnet/\n " ,
132+ " #!wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11e_sd15_shuffle_fp16.safetensors -P ./models/controlnet/\n " ,
133+ " #!wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_canny_fp16.safetensors -P ./models/controlnet/\n " ,
134+ " #!wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11f1p_sd15_depth_fp16.safetensors -P ./models/controlnet/\n " ,
135+ " #!wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_inpaint_fp16.safetensors -P ./models/controlnet/\n " ,
136+ " #!wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_lineart_fp16.safetensors -P ./models/controlnet/\n " ,
137+ " #!wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_mlsd_fp16.safetensors -P ./models/controlnet/\n " ,
138+ " #!wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_normalbae_fp16.safetensors -P ./models/controlnet/\n " ,
139+ " #!wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_openpose_fp16.safetensors -P ./models/controlnet/\n " ,
140+ " #!wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_scribble_fp16.safetensors -P ./models/controlnet/\n " ,
141+ " #!wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_seg_fp16.safetensors -P ./models/controlnet/\n " ,
142+ " #!wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_softedge_fp16.safetensors -P ./models/controlnet/\n " ,
143+ " #!wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors -P ./models/controlnet/\n " ,
144+ " #!wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11u_sd15_tile_fp16.safetensors -P ./models/controlnet/\n " ,
145+ " \n " ,
146+ " # ControlNet SDXL\n " ,
147+ " #!wget -c https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank256/control-lora-canny-rank256.safetensors -P ./models/controlnet/\n " ,
148+ " #!wget -c https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank256/control-lora-depth-rank256.safetensors -P ./models/controlnet/\n " ,
149+ " #!wget -c https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank256/control-lora-recolor-rank256.safetensors -P ./models/controlnet/\n " ,
150+ " #!wget -c https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank256/control-lora-sketch-rank256.safetensors -P ./models/controlnet/\n " ,
151+ " \n " ,
152+ " # Controlnet Preprocessor nodes by Fannovel16\n " ,
153+ " #!cd custom_nodes && git clone https://github.com/Fannovel16/comfy_controlnet_preprocessors; cd comfy_controlnet_preprocessors && python install.py\n " ,
154+ " \n " ,
155+ " \n " ,
156+ " # GLIGEN\n " ,
157+ " #!wget -c https://huggingface.co/comfyanonymous/GLIGEN_pruned_safetensors/resolve/main/gligen_sd14_textbox_pruned_fp16.safetensors -P ./models/gligen/\n " ,
158+ " \n " ,
159+ " \n " ,
160+ " # ESRGAN upscale model\n " ,
161+ " #!wget -c https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth -P ./models/upscale_models/\n " ,
162+ " #!wget -c https://huggingface.co/sberbank-ai/Real-ESRGAN/resolve/main/RealESRGAN_x2.pth -P ./models/upscale_models/\n " ,
163+ " #!wget -c https://huggingface.co/sberbank-ai/Real-ESRGAN/resolve/main/RealESRGAN_x4.pth -P ./models/upscale_models/\n " ,
164+ " \n " ,
165+ " \n "
166+ ]
167+ },
168+ {
169+ "cell_type" : " markdown" ,
170+ "metadata" : {
171+ "id" : " kkkkkkkkkkkkkkk"
172+ },
173+ "source" : [
174+ " ### Run ComfyUI with cloudflared (Recommended Way)\n " ,
175+ " \n " ,
176+ " \n "
177+ ]
178+ },
179+ {
180+ "cell_type" : " code" ,
181+ "execution_count" : null ,
182+ "metadata" : {
183+ "id" : " jjjjjjjjjjjjjj"
184+ },
185+ "outputs" : [],
186+ "source" : [
187+ " !wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb\n " ,
188+ " !dpkg -i cloudflared-linux-amd64.deb\n " ,
189+ " \n " ,
190+ " import subprocess\n " ,
191+ " import threading\n " ,
192+ " import time\n " ,
193+ " import socket\n " ,
194+ " import urllib.request\n " ,
195+ " \n " ,
196+ " def iframe_thread(port):\n " ,
197+ " while True:\n " ,
198+ " time.sleep(0.5)\n " ,
199+ " sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n " ,
200+ " result = sock.connect_ex(('127.0.0.1', port))\n " ,
201+ " if result == 0:\n " ,
202+ " break\n " ,
203+ " sock.close()\n " ,
204+ " print(\"\\ nComfyUI finished loading, trying to launch cloudflared (if it gets stuck here cloudflared is having issues)\\ n\" )\n " ,
205+ " \n " ,
206+ " p = subprocess.Popen([\" cloudflared\" , \" tunnel\" , \" --url\" , \" http://127.0.0.1:{}\" .format(port)], stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n " ,
207+ " for line in p.stderr:\n " ,
208+ " l = line.decode()\n " ,
209+ " if \" trycloudflare.com \" in l:\n " ,
210+ " print(\" This is the URL to access ComfyUI:\" , l[l.find(\" http\" ):], end='')\n " ,
211+ " #print(l, end='')\n " ,
212+ " \n " ,
213+ " \n " ,
214+ " threading.Thread(target=iframe_thread, daemon=True, args=(8188,)).start()\n " ,
215+ " \n " ,
216+ " !python main.py --dont-print-server"
217+ ]
218+ },
219+ {
220+ "cell_type" : " markdown" ,
221+ "metadata" : {
222+ "id" : " kkkkkkkkkkkkkk"
223+ },
224+ "source" : [
225+ " ### Run ComfyUI with localtunnel\n " ,
226+ " \n " ,
227+ " \n "
228+ ]
229+ },
230+ {
231+ "cell_type" : " code" ,
232+ "execution_count" : null ,
233+ "metadata" : {
234+ "id" : " jjjjjjjjjjjjj"
235+ },
236+ "outputs" : [],
237+ "source" : [
238+ " !npm install -g localtunnel\n " ,
239+ " \n " ,
240+ " import threading\n " ,
241+ " \n " ,
242+ " def iframe_thread(port):\n " ,
243+ " while True:\n " ,
244+ " time.sleep(0.5)\n " ,
245+ " sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n " ,
246+ " result = sock.connect_ex(('127.0.0.1', port))\n " ,
247+ " if result == 0:\n " ,
248+ " break\n " ,
249+ " sock.close()\n " ,
250+ " print(\"\\ nComfyUI finished loading, trying to launch localtunnel (if it gets stuck here localtunnel is having issues)\\ n\" )\n " ,
251+ " \n " ,
252+ " print(\" The password/enpoint ip for localtunnel is:\" , urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\ n\" ))\n " ,
253+ " p = subprocess.Popen([\" lt\" , \" --port\" , \" {}\" .format(port)], stdout=subprocess.PIPE)\n " ,
254+ " for line in p.stdout:\n " ,
255+ " print(line.decode(), end='')\n " ,
256+ " \n " ,
257+ " \n " ,
258+ " threading.Thread(target=iframe_thread, daemon=True, args=(8188,)).start()\n " ,
259+ " \n " ,
260+ " !python main.py --dont-print-server"
261+ ]
262+ },
263+ {
264+ "cell_type" : " markdown" ,
265+ "metadata" : {
266+ "id" : " gggggggggg"
267+ },
268+ "source" : [
269+ " ### Run ComfyUI with colab iframe (use only in case the previous way with localtunnel doesn't work)\n " ,
270+ " \n " ,
271+ " You should see the ui appear in an iframe. If you get a 403 error, it's your firefox settings or an extension that's messing things up.\n " ,
272+ " \n " ,
273+ " If you want to open it in another window use the link.\n " ,
274+ " \n " ,
275+ " Note that some UI features like live image previews won't work because the colab iframe blocks websockets."
276+ ]
277+ },
278+ {
279+ "cell_type" : " code" ,
280+ "execution_count" : null ,
281+ "metadata" : {
282+ "id" : " hhhhhhhhhh"
283+ },
284+ "outputs" : [],
285+ "source" : [
286+ " import threading\n " ,
287+ " def iframe_thread(port):\n " ,
288+ " while True:\n " ,
289+ " time.sleep(0.5)\n " ,
290+ " sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n " ,
291+ " result = sock.connect_ex(('127.0.0.1', port))\n " ,
292+ " if result == 0:\n " ,
293+ " break\n " ,
294+ " sock.close()\n " ,
295+ " from google.colab import output\n " ,
296+ " output.serve_kernel_port_as_iframe(port, height=1024)\n " ,
297+ " print(\" to open it in a window you can open this link here:\" )\n " ,
298+ " output.serve_kernel_port_as_window(port)\n " ,
299+ " \n " ,
300+ " threading.Thread(target=iframe_thread, daemon=True, args=(8188,)).start()\n " ,
301+ " \n " ,
302+ " !python main.py --dont-print-server"
303+ ]
304+ }
305+ ],
306+ "metadata" : {
307+ "accelerator" : " GPU" ,
308+ "colab" : {
309+ "provenance" : []
310+ },
311+ "gpuClass" : " standard" ,
312+ "kernelspec" : {
313+ "display_name" : " Python 3" ,
314+ "name" : " python3"
315+ },
316+ "language_info" : {
317+ "name" : " python"
318+ }
319+ },
320+ "nbformat" : 4 ,
321+ "nbformat_minor" : 0
322+ }
0 commit comments