2023-01-25 02:14:01 +00:00
|
|
|
{
|
|
|
|
"nbformat": 4,
|
|
|
|
"nbformat_minor": 0,
|
|
|
|
"metadata": {
|
|
|
|
"colab": {
|
|
|
|
"provenance": []
|
|
|
|
},
|
|
|
|
"kernelspec": {
|
|
|
|
"name": "python3",
|
|
|
|
"display_name": "Python 3"
|
|
|
|
},
|
|
|
|
"language_info": {
|
|
|
|
"name": "python"
|
|
|
|
},
|
|
|
|
"accelerator": "GPU",
|
|
|
|
"gpuClass": "standard"
|
|
|
|
},
|
|
|
|
"cells": [
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"source": [
|
2023-01-26 17:31:41 +00:00
|
|
|
"Git clone the repo and install the requirements. (ignore the pip errors about protobuf)"
|
2023-01-25 02:14:01 +00:00
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"id": "aaaaaaaaaa"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"metadata": {
|
|
|
|
"id": "bbbbbbbbbb"
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"!git clone https://github.com/comfyanonymous/ComfyUI\n",
|
|
|
|
"%cd ComfyUI\n",
|
2023-03-06 17:02:02 +00:00
|
|
|
"!pip install xformers -r requirements.txt"
|
2023-01-25 02:14:01 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"source": [
|
2023-03-03 19:52:39 +00:00
|
|
|
"Download some models/checkpoints/vae or custom comfyui nodes (uncomment the commands for the ones you want)"
|
2023-01-25 02:14:01 +00:00
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"id": "cccccccccc"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"source": [
|
2023-02-26 06:54:17 +00:00
|
|
|
"# Checkpoints\n",
|
|
|
|
"\n",
|
|
|
|
"# SD1.5\n",
|
2023-03-05 08:05:58 +00:00
|
|
|
"!wget -c https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt -P ./models/checkpoints/\n",
|
2023-02-26 06:54:17 +00:00
|
|
|
"\n",
|
|
|
|
"# SD2\n",
|
2023-03-05 08:05:58 +00:00
|
|
|
"#!wget -c https://huggingface.co/stabilityai/stable-diffusion-2-1-base/resolve/main/v2-1_512-ema-pruned.safetensors -P ./models/checkpoints/\n",
|
|
|
|
"#!wget -c https://huggingface.co/stabilityai/stable-diffusion-2-1/resolve/main/v2-1_768-ema-pruned.safetensors -P ./models/checkpoints/\n",
|
2023-02-26 06:54:17 +00:00
|
|
|
"\n",
|
2023-03-01 15:40:26 +00:00
|
|
|
"# Some SD1.5 anime style\n",
|
2023-03-05 08:05:58 +00:00
|
|
|
"#!wget -c https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/Models/AbyssOrangeMix2/AbyssOrangeMix2_hard.safetensors -P ./models/checkpoints/\n",
|
|
|
|
"#!wget -c https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/Models/AbyssOrangeMix3/AOM3A1.safetensors -P ./models/checkpoints/\n",
|
|
|
|
"#!wget -c https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/Models/AbyssOrangeMix3/AOM3A3.safetensors -P ./models/checkpoints/\n",
|
|
|
|
"#!wget -c https://huggingface.co/Linaqruf/anything-v3.0/resolve/main/anything-v3-fp16-pruned.safetensors -P ./models/checkpoints/\n",
|
2023-02-26 06:54:17 +00:00
|
|
|
"\n",
|
2023-03-01 15:40:26 +00:00
|
|
|
"# Waifu Diffusion 1.5 (anime style SD2.x 768-v)\n",
|
2023-03-05 08:05:58 +00:00
|
|
|
"#!wget -c https://huggingface.co/waifu-diffusion/wd-1-5-beta2/resolve/main/checkpoints/wd-1-5-beta2-fp16.safetensors -P ./models/checkpoints/\n",
|
2023-03-01 15:40:26 +00:00
|
|
|
"\n",
|
2023-02-26 06:54:17 +00:00
|
|
|
"\n",
|
|
|
|
"# VAE\n",
|
2023-03-05 08:05:58 +00:00
|
|
|
"!wget -c https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors -P ./models/vae/\n",
|
|
|
|
"#!wget -c https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/VAEs/orangemix.vae.pt -P ./models/vae/\n",
|
2023-02-26 06:54:17 +00:00
|
|
|
"\n",
|
|
|
|
"\n",
|
2023-03-01 15:40:26 +00:00
|
|
|
"# Loras\n",
|
2023-03-05 08:05:58 +00:00
|
|
|
"#!wget -c --content-disposition https://civitai.com/api/download/models/10350 -P ./models/loras/ #theovercomer8sContrastFix SD2.x 768-v\n",
|
|
|
|
"#!wget -c --content-disposition https://civitai.com/api/download/models/10638 -P ./models/loras/ #theovercomer8sContrastFix SD1.x\n",
|
2023-03-01 15:40:26 +00:00
|
|
|
"\n",
|
|
|
|
"\n",
|
2023-02-26 06:54:17 +00:00
|
|
|
"# T2I-Adapter\n",
|
2023-03-05 08:05:58 +00:00
|
|
|
"#!wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_depth_sd14v1.pth -P ./models/t2i_adapter/\n",
|
|
|
|
"#!wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_seg_sd14v1.pth -P ./models/t2i_adapter/\n",
|
|
|
|
"#!wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_sketch_sd14v1.pth -P ./models/t2i_adapter/\n",
|
|
|
|
"#!wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_keypose_sd14v1.pth -P ./models/t2i_adapter/\n",
|
|
|
|
"#!wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_openpose_sd14v1.pth -P ./models/t2i_adapter/\n",
|
|
|
|
"#!wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_color_sd14v1.pth -P ./models/t2i_adapter/\n",
|
|
|
|
"#!wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_canny_sd14v1.pth -P ./models/t2i_adapter/\n",
|
|
|
|
"\n",
|
2023-03-06 07:07:58 +00:00
|
|
|
"# T2I Styles Model\n",
|
|
|
|
"#!wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_style_sd14v1.pth -P ./models/style_models/\n",
|
|
|
|
"\n",
|
|
|
|
"# CLIPVision model (needed for styles model)\n",
|
|
|
|
"#!wget -c https://huggingface.co/openai/clip-vit-large-patch14/resolve/main/pytorch_model.bin -O ./models/clip_vision/clip_vit14.bin\n",
|
2023-02-26 06:54:17 +00:00
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"# ControlNet\n",
|
2023-03-05 08:05:58 +00:00
|
|
|
"#!wget -c https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_depth-fp16.safetensors -P ./models/controlnet/\n",
|
|
|
|
"#!wget -c https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_scribble-fp16.safetensors -P ./models/controlnet/\n",
|
|
|
|
"#!wget -c https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_openpose-fp16.safetensors -P ./models/controlnet/\n",
|
2023-03-03 19:52:39 +00:00
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"# Controlnet Preprocessor nodes by Fannovel16\n",
|
|
|
|
"#!cd custom_nodes && git clone https://github.com/Fannovel16/comfy_controlnet_preprocessors; cd comfy_controlnet_preprocessors && python install.py\n",
|
|
|
|
"\n"
|
2023-01-25 02:14:01 +00:00
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"id": "dddddddddd"
|
|
|
|
},
|
|
|
|
"execution_count": null,
|
|
|
|
"outputs": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"source": [
|
2023-03-04 13:46:39 +00:00
|
|
|
"### Run ComfyUI with localtunnel (Recommended Way)\n",
|
2023-02-22 22:15:10 +00:00
|
|
|
"\n",
|
2023-02-26 03:49:22 +00:00
|
|
|
"use the **fp16** model configs for more speed\n",
|
|
|
|
"\n"
|
2023-01-25 02:14:01 +00:00
|
|
|
],
|
|
|
|
"metadata": {
|
2023-02-26 03:49:22 +00:00
|
|
|
"id": "kkkkkkkkkkkkkk"
|
2023-01-25 02:14:01 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"source": [
|
2023-02-26 03:49:22 +00:00
|
|
|
"!npm install -g localtunnel\n",
|
|
|
|
"\n",
|
|
|
|
"import subprocess\n",
|
2023-01-28 02:48:48 +00:00
|
|
|
"import threading\n",
|
|
|
|
"import time\n",
|
|
|
|
"import socket\n",
|
|
|
|
"def iframe_thread(port):\n",
|
|
|
|
" while True:\n",
|
|
|
|
" time.sleep(0.5)\n",
|
|
|
|
" sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n",
|
|
|
|
" result = sock.connect_ex(('127.0.0.1', port))\n",
|
|
|
|
" if result == 0:\n",
|
|
|
|
" break\n",
|
|
|
|
" sock.close()\n",
|
2023-03-01 15:53:18 +00:00
|
|
|
" print(\"\\nComfyUI finished loading, trying to launch localtunnel (if it gets stuck here localtunnel is having issues)\")\n",
|
2023-02-26 03:49:22 +00:00
|
|
|
" p = subprocess.Popen([\"lt\", \"--port\", \"{}\".format(port)], stdout=subprocess.PIPE)\n",
|
|
|
|
" for line in p.stdout:\n",
|
|
|
|
" print(line.decode(), end='')\n",
|
|
|
|
"\n",
|
2023-01-28 02:54:46 +00:00
|
|
|
"\n",
|
2023-01-28 02:48:48 +00:00
|
|
|
"threading.Thread(target=iframe_thread, daemon=True, args=(8188,)).start()\n",
|
|
|
|
"\n",
|
2023-02-28 01:06:44 +00:00
|
|
|
"!python main.py --dont-print-server"
|
2023-01-25 02:14:01 +00:00
|
|
|
],
|
|
|
|
"metadata": {
|
2023-02-26 03:49:22 +00:00
|
|
|
"id": "jjjjjjjjjjjjj"
|
2023-01-25 02:14:01 +00:00
|
|
|
},
|
|
|
|
"execution_count": null,
|
|
|
|
"outputs": []
|
2023-02-23 15:16:30 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"source": [
|
2023-03-04 13:46:39 +00:00
|
|
|
"### Run ComfyUI with colab iframe (use only in case the previous way with localtunnel doesn't work)\n",
|
2023-02-26 03:49:22 +00:00
|
|
|
"use the **fp16** model configs for more speed\n",
|
2023-02-23 15:16:30 +00:00
|
|
|
"\n",
|
2023-02-26 03:49:22 +00:00
|
|
|
"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",
|
2023-02-23 15:16:30 +00:00
|
|
|
"\n",
|
2023-03-01 15:53:18 +00:00
|
|
|
"If you want to open it in another window use the link.\n",
|
|
|
|
"\n",
|
|
|
|
"Note that some UI features like live image previews won't work because the colab iframe blocks websockets."
|
2023-02-23 15:16:30 +00:00
|
|
|
],
|
|
|
|
"metadata": {
|
2023-02-26 03:49:22 +00:00
|
|
|
"id": "gggggggggg"
|
2023-02-23 15:16:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"source": [
|
|
|
|
"import threading\n",
|
|
|
|
"import time\n",
|
|
|
|
"import socket\n",
|
|
|
|
"def iframe_thread(port):\n",
|
|
|
|
" while True:\n",
|
|
|
|
" time.sleep(0.5)\n",
|
|
|
|
" sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n",
|
|
|
|
" result = sock.connect_ex(('127.0.0.1', port))\n",
|
|
|
|
" if result == 0:\n",
|
|
|
|
" break\n",
|
|
|
|
" sock.close()\n",
|
2023-02-26 03:49:22 +00:00
|
|
|
" from google.colab import output\n",
|
|
|
|
" output.serve_kernel_port_as_iframe(port, height=1024)\n",
|
|
|
|
" print(\"to open it in a window you can open this link here:\")\n",
|
|
|
|
" output.serve_kernel_port_as_window(port)\n",
|
2023-02-23 15:16:30 +00:00
|
|
|
"\n",
|
|
|
|
"threading.Thread(target=iframe_thread, daemon=True, args=(8188,)).start()\n",
|
|
|
|
"\n",
|
2023-02-28 00:57:39 +00:00
|
|
|
"!python main.py --dont-print-server"
|
2023-02-23 15:16:30 +00:00
|
|
|
],
|
|
|
|
"metadata": {
|
2023-02-26 03:49:22 +00:00
|
|
|
"id": "hhhhhhhhhh"
|
2023-02-23 15:16:30 +00:00
|
|
|
},
|
|
|
|
"execution_count": null,
|
|
|
|
"outputs": []
|
2023-01-25 02:14:01 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|