{ "cells": [ { "cell_type": "code", "source": [ "#Fetch the .zip file of the UI\n", "#Note that extensions are attached within this .zip file\n", "#A full list of extensions used can be found under sd/extensions/Extensions download URLs.txt\n", "%cd /content\n", "!curl -Lo sd.zip https://huggingface.co/Nekos4Lyfe/sd-kit/resolve/main/sd.zip\n", "!unzip sd.zip \n", "!rm sd.zip #remove .zip file" ], "metadata": { "id": "V1X7OSaLJuHa" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "#Download some basic ControlNET models \n", "!curl -Lo /content/sd/extensions/controlnet/models/control_v11p_sd15_canny.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11p_sd15_canny_fp16.safetensors\n", "!curl -Lo /content/sd/extensions/controlnet/models/t2iadapter_canny_sd14v1.pth https://huggingface.co/nolanaatama/models/resolve/main/t2iadapter_canny_sd14v1.pth\n", "!curl -Lo /content/sd/extensions/controlnet/models/control_v11p_sd15_lineart.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11p_sd15_lineart_fp16.safetensors\n", "!curl -Lo /content/sd/extensions/controlnet/models/control_v11p_sd15s2_lineart_anime.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors\n" ], "metadata": { "id": "3ab7ebbQIP-v" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "#from google.colab import drive\n", "#drive.mount('/content/drive')\n", "\n", "#Choose a model to store on Drive as backup. Here are some examples\n", "#!curl -Lo /content/drive/MyDrive/models/mistoon.safetensors https://civitai.com/api/download/models/28861\n", "#!curl -Lo /content/drive/MyDrive/models/ghostmix.safetensors https://civitai.com/api/download/models/64503\n", "#!curl -Lo /content/drive/MyDrive/models/darkside.safetensors https://civitai.com/api/download/models/63193\n", "#!curl -Lo /content/drive/MyDrive/models/lyriel.safetensors https://civitai.com/api/download/models/72396\n", "#!curl -Lo /content/drive/MyDrive/models/beenyou.safetensors https://civitai.com/api/download/models/64889\n", "#!curl -Lo /content/drive/MyDrive/models/analogmadness.safetensors https://civitai.com/api/download/models/56498\n", "\n", "#Store VAE on your drive for easy access in the future \n", "#!curl -Lo /content/drive/MyDrive/VAE/mse840000.vae.pt https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.ckpt #<--Commonly used VAE For photoreal models\n", "#!curl -Lo /content/drive/MyDrive/VAE/kl-f8-anime2.vae.pt https://civitai.com/api/download/models/28569 #<--Commonly used VAE For anime models\n", "\n", "#Add a preloaded model from your Google drive (recommended as civitai is slow/offline sometimes)\n", "#import shutil\n", "#shutil.copy(\"/content/drive/MyDrive/models/analogmadness.safetensors\", \n", "# \"/content/sd/models/Stable-diffusion/analogmadness.safetensors\")\n", "\n", "#Add VAE to model\n", "#shutil.copy(\"/content/drive/MyDrive/VAE/mse840000.vae.pt\", \n", "# \"/content/sd/models/Stable-diffusion/analogmadness.vae.pt\")" ], "metadata": { "id": "pFkOt218iAKp" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "#--------------Add a model from civitai (some examples provided):-------------------------------#\n", "#Baked VAE (No external VAE required)\n", "!curl -Lo /content/sd/models/Stable-diffusion/azovya-rpg.safetensors https://civitai.com/api/download/models/87886 #<---baked VAE\n", "\n", "#Photoreal models\n", "#!curl -Lo /content/sd/models/Stable-diffusion/analogmadness.safetensors https://civitai.com/api/download/models/56498\n", "\n", "#Anime models\n", "#!curl -Lo /content/sd/models/Stable-diffusion/mistoon.safetensors https://civitai.com/api/download/models/28861\n", "#!curl -Lo /content/sd/models/Stable-diffusion/beenyou.safetensors https://civitai.com/api/download/models/85614\n", "\n", "#model from Google Drive\n", "#import shutil\n", "#shutil.copy(\"/content/drive/MyDrive/models/analogmadness.safetensors\", \n", " # \"/content/sd/models/Stable-diffusion/analogmadness.safetensors\")\n", "\n", "#---------------Add VAE stored on drive to model:-----------------------#\n", "\n", "#Add VAE for anime models:\n", "#import shutil\n", "#shutil.copy(\"/content/drive/MyDrive/VAE/kl-f8-anime2.vae.pt\", \n", "# \"/content/sd/models/Stable-diffusion/mistoon.vae.pt\")\n", "\n", "#Add VAE for photoreal models:\n", "#import shutil\n", "#shutil.copy(\"/content/drive/MyDrive/VAE/mse840000.vae.pt\", \n", "# \"/content/sd/models/Stable-diffusion/analogmadness.vae.pt\")\n" ], "metadata": { "id": "TtUGrBEN7AsN" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "#Install dependencies\n", "!pip install --upgrade fastapi==0.90.1\n", "!pip install -q torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1+cu118 torchtext==0.15.1 torchdata==0.6.0 --extra-index-url https://download.pytorch.org/whl/cu118 -U\n", "!pip install -q xformers==0.0.18 triton==2.0.0 -U\n", "\n", "#run the webui once \n", "#Three blue links will appear to the UI\n", "#(This cell will run indefinetely until you press the square shaped \"Stop\" button <---)\n", "#\n", "%cd /content/sd\n", "!COMMANDLINE_ARGS=\"--share --disable-safe-unpickle --no-half-vae --xformers --enable-insecure-extension --gradio-queue --remotemoe --disable-console-progressbars\" REQS_FILE=\"requirements.txt\" python launch.py\n", "# If remotemoe failed to start, change '--remotemoe' to '--cloudflared' on the COMMANDLINE_ARGS line above to use cloudflare tunnel" ], "metadata": { "id": "XFottHPM31pS" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "#Add some embeddings after running the UI\n", "%cd /content\n", "!curl -Lo embeddings.zip https://huggingface.co/Nekos4Lyfe/sd-kit/resolve/main/embeddings.zip \n", "!unzip /content/embeddings.zip #Create new temporary embeddings folder with content\n", "\n", "!mv embeddings/* /content/sd/embeddings #Add content to UI embedding folder\n", "import shutil\n", "shutil.rmtree(\"embeddings\") #Remove temporary folder\n", "!rm embeddings.zip #remove .zip file\n", "\n", "#How to use: \n", "# For example , write \"no_Sketch\" in the negative prompt to activate no_Sketch.pt\n", "# or write angry512 in the positive prompt to activate angry512.pt" ], "metadata": { "id": "P3MTYF8fmVDY" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "b7FqKKN4tE3m" }, "outputs": [], "source": [ "#Add some LoRa:s after running the UI \n", "#Here the LoRa trigger words are the same as the LoRa .safetensor names\n", "!curl -Lo /content/sd/models/Lora/epinoise.safetensors https://civitai.com/api/download/models/16576\n", "!curl -Lo /content/sd/models/Lora/dieselpunkai.safetensors https://civitai.com/api/download/models/27755\n", "!curl -Lo /content/sd/models/Lora/hipoly.safetensors https://civitai.com/api/download/models/44566\n", "!curl -Lo /content/sd/models/Lora/1990s\\(style\\).safetensors https://civitai.com/api/download/models/54221\n", "!curl -Lo /content/sd/models/Lora/kids_illustration.safetensors https://civitai.com/api/download/models/67980\n", "!curl -Lo /content/sd/models/Lora/\\(illumination\\).safetensors https://civitai.com/api/download/models/42981\n", "!curl -Lo /content/sd/models/Lora/kusanagi_motoko.safetensors https://civitai.com/api/download/models/7692\n", "!curl -Lo /content/sd/models/Lora/WH40K_ork.safetensors https://civitai.com/api/download/models/63475\n", "!curl -Lo /content/sd/models/Lora/MSHN.safetensors https://civitai.com/api/download/models/62552\n", "!curl -Lo /content/sd/models/Lora/blame.safetensors https://civitai.com/api/download/models/55412\n", "!curl -Lo /content/sd/models/Lora/WH40K_Imperial_Guardsman.safetensors https://civitai.com/api/download/models/56778\n", "!curl -Lo /content/sd/models/Lora/WH40K_Commissar.safetensors https://civitai.com/api/download/models/56414\n", "!curl -Lo /content/sd/models/Lora/scared_expression.safetensors https://civitai.com/api/download/models/49924\n", "!curl -Lo /content/sd/models/Lora/graphic_novel.safetensors https://civitai.com/api/download/models/39455\n", "!curl -Lo /content/sd/models/Lora/>_<-@_@-=_=-X-X-._.-JITOME-:I.safetensors https://civitai.com/api/download/models/30666\n", "!curl -Lo /content/sd/models/Lora/emotion.safetensors https://civitai.com/api/download/models/14177\n", "!curl -Lo /content/sd/models/Lora/adepta_sororitas.safetensors https://civitai.com/api/download/models/12730\n", "!curl -Lo /content/sd/models/Lora/gmod.safetensors https://civitai.com/api/download/models/5988\n", "\n", "#How to use: \n", "# For example , write epinoise in the prompt to activate the Lora epinoise.safetensors" ] }, { "cell_type": "code", "source": [ "#Add some Wildcards after running the UI \n", "#These are not my own but fetched from here: https://www.sdcompendium.com/doku.php?id=start\n", "#(using the dynamic prompts extension baked into sd.zip)\n", "%cd /content\n", "!curl -Lo wildcards.zip https://huggingface.co/Nekos4Lyfe/sd-kit/resolve/main/wildcards.zip \n", "!unzip /content/wildcards.zip #Create new temporary embeddings folder with content\n", "\n", "!mv wildcards/* /content/sd/extensions/sd-dynamic-prompts/wildcards #Add content to UI embedding folder\n", "import shutil\n", "shutil.rmtree(\"wildcards\") #Remove temporary folder\n", "!rm wildcards.zip #remove .zip file\n", "\n", "#How to use: \n", "# refer to sd-dynamic-prompts guide available on github" ], "metadata": { "id": "3hPt2WCNEy9f" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "#Run the UI again with the LoRa and embeddings\n", "#To access the LoRa and embeddings, click one of the buttons beneath the big \"Generate!\" button. \n", "#It's the button beneath \"Generate!\" right in the middle with some orange on it. \n", "#Scroll up to find the UI links\n", "%cd /content/sd\n", "!COMMANDLINE_ARGS=\"--share --disable-safe-unpickle --no-half-vae --xformers --enable-insecure-extension --gradio-queue --remotemoe --disable-console-progressbars\" REQS_FILE=\"requirements.txt\" python launch.py\n", "# If remotemoe failed to start, change '--remotemoe' to '--cloudflared' on the COMMANDLINE_ARGS line above to use cloudflare tunnel" ], "metadata": { "id": "2jdGVvT19hk2" }, "execution_count": null, "outputs": [] } ], "metadata": { "colab": { "provenance": [], "gpuType": "T4" }, "kernelspec": { "display_name": "Python 3", "name": "python3" }, "language_info": { "name": "python" }, "accelerator": "GPU" }, "nbformat": 4, "nbformat_minor": 0 }