├── README.md ├── loadgdrivemodel.ipynb ├── loadsafetensors.ipynb ├── gdrive_LoRA.ipynb ├── mergemodels.ipynb └── loadembeddingsti.ipynb /README.md: -------------------------------------------------------------------------------- 1 | # sd-misc-colab 2 | -------------------------------------------------------------------------------- /loadgdrivemodel.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "nbformat": 4, 3 | "nbformat_minor": 0, 4 | "metadata": { 5 | "colab": { 6 | "provenance": [] 7 | }, 8 | "kernelspec": { 9 | "name": "python3", 10 | "display_name": "Python 3" 11 | }, 12 | "language_info": { 13 | "name": "python" 14 | }, 15 | "accelerator": "GPU", 16 | "gpuClass": "standard" 17 | }, 18 | "cells": [ 19 | { 20 | "cell_type": "code", 21 | "execution_count": null, 22 | "metadata": { 23 | "id": "3xdPbMujWYJ8" 24 | }, 25 | "outputs": [], 26 | "source": [ 27 | "from google.colab import drive\n", 28 | "drive.mount('/content/drive')" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "source": [ 34 | "!pip install --upgrade fastapi==0.90.1\n", 35 | "!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui\n", 36 | "!git clone https://github.com/yfszzx/stable-diffusion-webui-images-browser /content/stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser\n", 37 | "!git clone https://github.com/DominikDoom/a1111-sd-webui-tagcomplete /content/stable-diffusion-webui/extensions/a1111-sd-webui-tagcomplete\n", 38 | "\n", 39 | "# CHANGE THE FILE PATH BELOW WITH OUR MODEL PATH\n", 40 | "\n", 41 | "!cp \"/content/drive/MyDrive/mymodel/OURMODELNAME.ckpt\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 42 | "\n", 43 | "# remove '#' from the beginning of these lines below and change the file path if we want to load more than one model\n", 44 | "# !cp \"/content/drive/MyDrive/mymodel/OURMODELNAME.ckpt\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 45 | "# !cp \"/content/drive/MyDrive/mymodel/OURMODELNAME.ckpt\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 46 | "\n", 47 | "import shutil\n", 48 | "shutil.rmtree('/content/stable-diffusion-webui/embeddings')\n", 49 | "%cd /content/stable-diffusion-webui\n", 50 | "!git checkout 3715ece\n", 51 | "!git clone https://huggingface.co/nolanaatama/embeddings\n", 52 | "!COMMANDLINE_ARGS=\"--share --disable-safe-unpickle --no-half-vae --xformers --reinstall-xformers --enable-insecure-extension-access\" REQS_FILE=\"requirements.txt\" python launch.py" 53 | ], 54 | "metadata": { 55 | "id": "Hu_vWtpHWeEI" 56 | }, 57 | "execution_count": null, 58 | "outputs": [] 59 | }, 60 | { 61 | "cell_type": "markdown", 62 | "source": [ 63 | "# 📚 GitHub for more: [_@nolanaatama_](https://github.com/nolanaatama)\n", 64 | "# 📦 Repo: [Github](https://github.com/nolanaatama/sd-misc-colab)\n", 65 | "# ▶️ Load models from Google Drive: https://youtu.be/MwyfwPFezvY\n", 66 | "# ▶️ How to load more than one model: https://youtu.be/vj-QrS_mWQI" 67 | ], 68 | "metadata": { 69 | "id": "qZ2T45cHgOK8" 70 | } 71 | } 72 | ] 73 | } -------------------------------------------------------------------------------- /loadsafetensors.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "source": [ 6 | "# 1. Using model code" 7 | ], 8 | "metadata": { 9 | "id": "QQeS3zRfAqXs" 10 | } 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": null, 15 | "metadata": { 16 | "id": "sBbcB4vwj_jm" 17 | }, 18 | "outputs": [], 19 | "source": [ 20 | "!pip install --upgrade fastapi==0.90.1\n", 21 | "!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui\n", 22 | "!git clone https://github.com/yfszzx/stable-diffusion-webui-images-browser /content/stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser\n", 23 | "!git clone https://github.com/DominikDoom/a1111-sd-webui-tagcomplete /content/stable-diffusion-webui/extensions/a1111-sd-webui-tagcomplete\n", 24 | "\n", 25 | "# change the code below with our desired model code. example code below is for SamDoesSexy Blend model\n", 26 | "!curl -Lo samdoessexy.safetensors https://huggingface.co/nolanaatama/sdsb/resolve/main/sdsb.safetensors\n", 27 | "!mv \"/content/samdoessexy.safetensors\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 28 | "\n", 29 | "# remove '#' from the beginning of these lines below and change the code to our desired model code if we want to load more than one model\n", 30 | "# !curl -Lo model2.safetensors https://huggingface.co/nolanaatama/sdsb/resolve/main/model2.safetensors\n", 31 | "# !mv \"/content/model2.safetensors\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 32 | "\n", 33 | "# !curl -Lo model3.safetensors https://huggingface.co/nolanaatama/sdsb/resolve/main/model3.safetensors\n", 34 | "# !mv \"/content/model3.safetensors\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 35 | "\n", 36 | "# model 4 and so on ...\n", 37 | "\n", 38 | "import shutil\n", 39 | "shutil.rmtree('/content/stable-diffusion-webui/embeddings')\n", 40 | "%cd /content/stable-diffusion-webui\n", 41 | "!git checkout 3715ece\n", 42 | "!git clone https://huggingface.co/nolanaatama/embeddings\n", 43 | "!COMMANDLINE_ARGS=\"--share --disable-safe-unpickle --no-half-vae --xformers --reinstall-xformers --enable-insecure-extension-access\" REQS_FILE=\"requirements.txt\" python launch.py" 44 | ] 45 | }, 46 | { 47 | "cell_type": "markdown", 48 | "source": [ 49 | "# 2. Load from Google Drive" 50 | ], 51 | "metadata": { 52 | "id": "VmuGi5lUAzn0" 53 | } 54 | }, 55 | { 56 | "cell_type": "code", 57 | "source": [ 58 | "from google.colab import drive\n", 59 | "drive.mount('/content/drive')" 60 | ], 61 | "metadata": { 62 | "id": "VYW31xRr-Q8b" 63 | }, 64 | "execution_count": null, 65 | "outputs": [] 66 | }, 67 | { 68 | "cell_type": "code", 69 | "source": [ 70 | "!pip install --upgrade fastapi==0.90.1\n", 71 | "!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui\n", 72 | "!git clone https://github.com/yfszzx/stable-diffusion-webui-images-browser /content/stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser\n", 73 | "!git clone https://github.com/DominikDoom/a1111-sd-webui-tagcomplete /content/stable-diffusion-webui/extensions/a1111-sd-webui-tagcomplete\n", 74 | "\n", 75 | "# change the file path below with our model path\n", 76 | "\n", 77 | "!cp \"/content/drive/MyDrive/mymodel/OURMODELNAME.safetensors\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 78 | "\n", 79 | "# remove '#' from the beginning of these lines below and change the file path if we want to load more than one model\n", 80 | "# !cp \"/content/drive/MyDrive/mymodel/OURMODELNAME2.safetensors\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 81 | "# !cp \"/content/drive/MyDrive/mymodel/OURMODELNAME3.safetensors\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 82 | "\n", 83 | "import shutil\n", 84 | "shutil.rmtree('/content/stable-diffusion-webui/embeddings')\n", 85 | "%cd /content/stable-diffusion-webui\n", 86 | "!git checkout 3715ece\n", 87 | "!git clone https://huggingface.co/nolanaatama/embeddings\n", 88 | "!COMMANDLINE_ARGS=\"--share --disable-safe-unpickle --no-half-vae --xformers --reinstall-xformers --enable-insecure-extension-access\" REQS_FILE=\"requirements.txt\" python launch.py" 89 | ], 90 | "metadata": { 91 | "id": "eYjJ-0mOBs00" 92 | }, 93 | "execution_count": null, 94 | "outputs": [] 95 | }, 96 | { 97 | "cell_type": "markdown", 98 | "metadata": { 99 | "id": "fhwIXzcgfkoR" 100 | }, 101 | "source": [ 102 | "# 📚 GitHub for more: [_@nolanaatama_](https://github.com/nolanaatama)\n", 103 | "# 📦 Repo: [Github](https://github.com/nolanaatama/sd-misc-colab)" 104 | ] 105 | } 106 | ], 107 | "metadata": { 108 | "accelerator": "GPU", 109 | "colab": { 110 | "provenance": [] 111 | }, 112 | "gpuClass": "standard", 113 | "kernelspec": { 114 | "display_name": "Python 3", 115 | "name": "python3" 116 | }, 117 | "language_info": { 118 | "name": "python" 119 | } 120 | }, 121 | "nbformat": 4, 122 | "nbformat_minor": 0 123 | } -------------------------------------------------------------------------------- /gdrive_LoRA.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "source": [ 6 | "# 1. Setup the web ui" 7 | ], 8 | "metadata": { 9 | "id": "bsiZpfkU7S77" 10 | } 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": null, 15 | "metadata": { 16 | "id": "sBbcB4vwj_jm" 17 | }, 18 | "outputs": [], 19 | "source": [ 20 | "!pip install --upgrade fastapi==0.90.1\n", 21 | "!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui\n", 22 | "!git clone https://github.com/yfszzx/stable-diffusion-webui-images-browser /content/stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser\n", 23 | "!git clone https://github.com/DominikDoom/a1111-sd-webui-tagcomplete /content/stable-diffusion-webui/extensions/a1111-sd-webui-tagcomplete\n", 24 | "\n", 25 | "# Model(s) setup\n", 26 | "# Below are model code for ChilloutMix, we always could change it to our desired model (how-to: https://youtu.be/vj-QrS_mWQI or https://youtu.be/MwyfwPFezvY)\n", 27 | "!curl -Lo chilloutmixni.safetensors https://huggingface.co/nolanaatama/chomni/resolve/main/chomni.safetensors\n", 28 | "!mv \"/content/chilloutmixni.safetensors\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 29 | "\n", 30 | "import shutil\n", 31 | "shutil.rmtree('/content/stable-diffusion-webui/embeddings')\n", 32 | "%cd /content/stable-diffusion-webui\n", 33 | "!git checkout 3715ece\n", 34 | "!git clone https://huggingface.co/nolanaatama/embeddings\n", 35 | "!COMMANDLINE_ARGS=\"--share --disable-safe-unpickle --enable-insecure-extension-access\" REQS_FILE=\"requirements.txt\" python launch.py" 36 | ] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "source": [ 41 | "# 2. After the gradio link show up, stop the first cell & clear the code output👆" 42 | ], 43 | "metadata": { 44 | "id": "JUtPlg328avv" 45 | } 46 | }, 47 | { 48 | "cell_type": "markdown", 49 | "source": [ 50 | "# 3. Mount our drive" 51 | ], 52 | "metadata": { 53 | "id": "qxhOCPrg7WXm" 54 | } 55 | }, 56 | { 57 | "cell_type": "code", 58 | "source": [ 59 | "from google.colab import drive\n", 60 | "drive.mount('/content/drive')" 61 | ], 62 | "metadata": { 63 | "id": "alypPmxi69M4" 64 | }, 65 | "execution_count": null, 66 | "outputs": [] 67 | }, 68 | { 69 | "cell_type": "markdown", 70 | "source": [ 71 | "# 4. Load the LoRA(s)" 72 | ], 73 | "metadata": { 74 | "id": "DQwVPx-t8Nol" 75 | } 76 | }, 77 | { 78 | "cell_type": "markdown", 79 | "source": [ 80 | "OPTION 1: choose individual LoRA" 81 | ], 82 | "metadata": { 83 | "id": "OJx4QIQosMMq" 84 | } 85 | }, 86 | { 87 | "cell_type": "code", 88 | "source": [ 89 | "# Change the file path to our LoRA file path.\n", 90 | "# Remove the '#' from the beginning of the other lines to load additional files.\n", 91 | "\n", 92 | "!cp \"/content/drive/MyDrive/our_LoRA_folder/OURLORAFILE1.pt\" \"/content/stable-diffusion-webui/models/Lora\"\n", 93 | "#!cp \"/content/drive/MyDrive/our_LoRA_folder/OURLORAFILE2.pt\" \"/content/stable-diffusion-webui/models/Lora\"\n", 94 | "#!cp \"/content/drive/MyDrive/our_LoRA_folder/OURLORAFILE3.pt\" \"/content/stable-diffusion-webui/models/Lora\"\n", 95 | "#!cp \"/content/drive/MyDrive/our_LoRA_folder/OURLORAFILE4.pt\" \"/content/stable-diffusion-webui/models/Lora\"\n", 96 | "#!cp \"/content/drive/MyDrive/our_LoRA_folder/OURLORAFILE5.pt\" \"/content/stable-diffusion-webui/models/Lora\"\n", 97 | "#!cp \"/content/drive/MyDrive/our_LoRA_folder/OURLORAFILE6.pt\" \"/content/stable-diffusion-webui/models/Lora\"\n", 98 | "#!cp \"/content/drive/MyDrive/our_LoRA_folder/OURLORAFILE7.pt\" \"/content/stable-diffusion-webui/models/Lora\"\n", 99 | "#!cp \"/content/drive/MyDrive/our_LoRA_folder/OURLORAFILE8.pt\" \"/content/stable-diffusion-webui/models/Lora\"\n", 100 | "# ...." 101 | ], 102 | "metadata": { 103 | "id": "1E0f1kMTrGJ0" 104 | }, 105 | "execution_count": null, 106 | "outputs": [] 107 | }, 108 | { 109 | "cell_type": "markdown", 110 | "source": [ 111 | "OPTION 2: copy all LoRA files from google drive folder" 112 | ], 113 | "metadata": { 114 | "id": "47CPtGUfsar8" 115 | } 116 | }, 117 | { 118 | "cell_type": "code", 119 | "source": [ 120 | "# Remove the '#' from the '!cp -r ...' line and change the file path to our LoRA folder path.\n", 121 | "# The LoRA folder path must be ended with '/.' like '/folder/subfolder/.'\n", 122 | "\n", 123 | "!cp -r '/content/drive/MyDrive/our_LoRA_folder1/.' '/content/stable-diffusion-webui/models/Lora'\n", 124 | "#!cp -r '/content/drive/MyDrive/our_LoRA_folder2/.' '/content/stable-diffusion-webui/models/Lora'\n", 125 | "#!cp -r '/content/drive/MyDrive/our_LoRA_folder3/.' '/content/stable-diffusion-webui/models/Lora'\n", 126 | "# ...." 127 | ], 128 | "metadata": { 129 | "id": "dKmIwc3lsYR6" 130 | }, 131 | "execution_count": null, 132 | "outputs": [] 133 | }, 134 | { 135 | "cell_type": "markdown", 136 | "source": [ 137 | "# 5. Launch the web ui" 138 | ], 139 | "metadata": { 140 | "id": "R-WXDJ8n8R2X" 141 | } 142 | }, 143 | { 144 | "cell_type": "code", 145 | "source": [ 146 | "!COMMANDLINE_ARGS=\"--share --disable-safe-unpickle --no-half-vae --xformers --reinstall-xformers --enable-insecure-extension-access\" REQS_FILE=\"requirements.txt\" python launch.py" 147 | ], 148 | "metadata": { 149 | "id": "TFuxn-DE7t82" 150 | }, 151 | "execution_count": null, 152 | "outputs": [] 153 | }, 154 | { 155 | "cell_type": "markdown", 156 | "metadata": { 157 | "id": "fhwIXzcgfkoR" 158 | }, 159 | "source": [ 160 | "# 📚 GitHub for more: [_@nolanaatama_](https://github.com/nolanaatama)\n", 161 | "# 📦 Repo: [Github](https://github.com/nolanaatama/sd-misc-colab)" 162 | ] 163 | } 164 | ], 165 | "metadata": { 166 | "accelerator": "GPU", 167 | "colab": { 168 | "provenance": [] 169 | }, 170 | "gpuClass": "standard", 171 | "kernelspec": { 172 | "display_name": "Python 3", 173 | "name": "python3" 174 | }, 175 | "language_info": { 176 | "name": "python" 177 | } 178 | }, 179 | "nbformat": 4, 180 | "nbformat_minor": 0 181 | } -------------------------------------------------------------------------------- /mergemodels.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": { 7 | "id": "sBbcB4vwj_jm" 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "!pip install --upgrade fastapi==0.90.1\n", 12 | "!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui\n", 13 | "\n", 14 | "########## paste our models code below .. \n", 15 | "\n", 16 | "# model 1 (change to our desired model code (below is code for Anything V3))\n", 17 | "!curl -Lo anythingv3.ckpt https://huggingface.co/nolanaatama/av3/resolve/main/av3.ckpt\n", 18 | "!curl -Lo anythingv3.vae.pt https://huggingface.co/nolanaatama/av3/resolve/main/av3.vae.pt\n", 19 | "!mv \"/content/anythingv3.ckpt\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 20 | "!mv \"/content/anythingv3.vae.pt\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 21 | "\n", 22 | "# model 2 (change to our desired model code (below is code for Analog Diffusion))\n", 23 | "!curl -Lo analog.ckpt https://huggingface.co/wavymulder/Analog-Diffusion/resolve/main/analog-diffusion-1.0.ckpt\n", 24 | "!mv \"/content/analog.ckpt\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 25 | "\n", 26 | "# OPTIONAL model 3 (remove '#' from the beginning of both lines below if we want to merge 3 models and use the 'Add difference' option. Change both line to our desired model code (below is code for HassanBlend 1.4))\n", 27 | "# !curl -Lo hb.ckpt https://huggingface.co/hassanblend/hassanblend1.4/resolve/main/HassanBlend1.4-Pruned.ckpt\n", 28 | "# !mv \"/content/hb.ckpt\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 29 | "\n", 30 | "########## paste our models code above ..\n", 31 | "\n", 32 | "%cd /content/stable-diffusion-webui\n", 33 | "!git checkout 11d432d # temporary fix\n", 34 | "!sed -i 's/else \"cpu\"/else devices.get_optimal_device()/g' modules/shared.py\n", 35 | "!sed -i \"s/'cpu'/devices.get_optimal_device()/g\" modules/extras.py\n", 36 | "!COMMANDLINE_ARGS=\"--share --lowvram --disable-safe-unpickle\" REQS_FILE=\"requirements.txt\" python launch.py" 37 | ] 38 | }, 39 | { 40 | "cell_type": "markdown", 41 | "source": [ 42 | "# Test our merged model (in same Runtime)\n", 43 | "We can run the cell below to test our merged model if we still connected with the same runtime when we merged the models." 44 | ], 45 | "metadata": { 46 | "id": "YqPEFpE-yA8H" 47 | } 48 | }, 49 | { 50 | "cell_type": "code", 51 | "source": [ 52 | "%pip install -q https://github.com/nolanaatama/sd-webui/releases/download/xformers/xformers-0.0.15+e163309.d20230103-cp38-cp38-linux_x86_64.whl\n", 53 | "!COMMANDLINE_ARGS=\"--share --gradio-debug --medvram --disable-safe-unpickle --xformers\" REQS_FILE=\"requirements.txt\" python launch.py" 54 | ], 55 | "metadata": { 56 | "id": "j_cBdpVMywMT" 57 | }, 58 | "execution_count": null, 59 | "outputs": [] 60 | }, 61 | { 62 | "cell_type": "markdown", 63 | "source": [ 64 | "# Save our merged model to Google Drive" 65 | ], 66 | "metadata": { 67 | "id": "7Shik7DQtTZ6" 68 | } 69 | }, 70 | { 71 | "cell_type": "code", 72 | "source": [ 73 | "from google.colab import drive\n", 74 | "drive.mount('/content/gdrive')" 75 | ], 76 | "metadata": { 77 | "id": "JzCgoEaAtYzR" 78 | }, 79 | "execution_count": null, 80 | "outputs": [] 81 | }, 82 | { 83 | "cell_type": "code", 84 | "source": [ 85 | "# CHANGE THE FILE NAME WITH OUR MODEL NAME\n", 86 | "!mkdir \"/content/gdrive/MyDrive/mymodel\"\n", 87 | "!cp \"/content/stable-diffusion-webui/models/Stable-diffusion/OURMODELNAME.ckpt\" \"/content/gdrive/MyDrive/mymodel\"" 88 | ], 89 | "metadata": { 90 | "id": "kPm4e3kBtwwS" 91 | }, 92 | "execution_count": null, 93 | "outputs": [] 94 | }, 95 | { 96 | "cell_type": "markdown", 97 | "source": [ 98 | "# Test our merged model (in different Runtime)\n", 99 | "\n", 100 | "Run the cell below to test our merged model if we already saved the model in our google drive but disconnected from the runtime when we merged the models, or when we come back to this file and only want to run our merged model again (the next day for example).\n", 101 | "\n", 102 | "How to load models from google drive: https://youtu.be/MwyfwPFezvY" 103 | ], 104 | "metadata": { 105 | "id": "ghLSoCsrI-3B" 106 | } 107 | }, 108 | { 109 | "cell_type": "code", 110 | "source": [ 111 | "from google.colab import drive\n", 112 | "drive.mount('/content/gdrive')" 113 | ], 114 | "metadata": { 115 | "id": "IB-CPcXkJX_i" 116 | }, 117 | "execution_count": null, 118 | "outputs": [] 119 | }, 120 | { 121 | "cell_type": "code", 122 | "source": [ 123 | "!pip install --upgrade fastapi==0.90.0\n", 124 | "!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui\n", 125 | "%pip install -q https://github.com/nolanaatama/sd-webui/releases/download/xformers/xformers-0.0.15+e163309.d20230103-cp38-cp38-linux_x86_64.whl\n", 126 | "\n", 127 | "# CHANGE THE FILE PATH BELOW WITH OUR MODEL PATH\n", 128 | "\n", 129 | "!cp \"/content/gdrive/MyDrive/mymodel/OURMODELNAME.ckpt\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 130 | "\n", 131 | "# CHANGE THE FILE PATH ABOVE WITH OUR MODEL PATH\n", 132 | "\n", 133 | "%cd /content/stable-diffusion-webui\n", 134 | "!git checkout 11d432d # temporary fix\n", 135 | "!COMMANDLINE_ARGS=\"--share --gradio-debug --medvram --disable-safe-unpickle --xformers\" REQS_FILE=\"requirements.txt\" python launch.py" 136 | ], 137 | "metadata": { 138 | "id": "oHgUOg31JR30" 139 | }, 140 | "execution_count": null, 141 | "outputs": [] 142 | }, 143 | { 144 | "cell_type": "markdown", 145 | "metadata": { 146 | "id": "fhwIXzcgfkoR" 147 | }, 148 | "source": [ 149 | "# ▶️ How to Merge Models on Google Colab: https://youtu.be/fCT0m8kuDKY\n", 150 | "# ▶️ How to Load More Than One Model: https://youtu.be/vj-QrS_mWQI\n", 151 | "# ▶️ How to Load Models From Google Drive: https://youtu.be/MwyfwPFezvY\n", 152 | "# 📚 GitHub for more: [_@nolanaatama_](https://github.com/nolanaatama)\n", 153 | "# 📦 Repo: [Github](https://github.com/nolanaatama/sd-misc-colab)" 154 | ] 155 | } 156 | ], 157 | "metadata": { 158 | "accelerator": "GPU", 159 | "colab": { 160 | "provenance": [] 161 | }, 162 | "gpuClass": "standard", 163 | "kernelspec": { 164 | "display_name": "Python 3", 165 | "name": "python3" 166 | }, 167 | "language_info": { 168 | "name": "python" 169 | } 170 | }, 171 | "nbformat": 4, 172 | "nbformat_minor": 0 173 | } -------------------------------------------------------------------------------- /loadembeddingsti.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "source": [ 6 | "# 1. Mount our Google Drive" 7 | ], 8 | "metadata": { 9 | "id": "k0RucGsXq75K" 10 | } 11 | }, 12 | { 13 | "cell_type": "code", 14 | "source": [ 15 | "from google.colab import drive\n", 16 | "drive.mount('/content/drive')" 17 | ], 18 | "metadata": { 19 | "id": "9S8FGAiSCm-1" 20 | }, 21 | "execution_count": null, 22 | "outputs": [] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "source": [ 27 | "# 2. Install AUTOMATIC1111 web ui" 28 | ], 29 | "metadata": { 30 | "id": "Ot1k1iRX3U63" 31 | } 32 | }, 33 | { 34 | "cell_type": "code", 35 | "source": [ 36 | "!pip install --upgrade fastapi==0.90.1\n", 37 | "!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui\n", 38 | "!git clone https://github.com/yfszzx/stable-diffusion-webui-images-browser /content/stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser\n", 39 | "!git clone https://github.com/DominikDoom/a1111-sd-webui-tagcomplete /content/stable-diffusion-webui/extensions/a1111-sd-webui-tagcomplete" 40 | ], 41 | "metadata": { 42 | "id": "H6lLF1he3cIF" 43 | }, 44 | "execution_count": null, 45 | "outputs": [] 46 | }, 47 | { 48 | "cell_type": "markdown", 49 | "source": [ 50 | "# 3. Load our model(s)" 51 | ], 52 | "metadata": { 53 | "id": "sWvJQj9eq7Gd" 54 | } 55 | }, 56 | { 57 | "cell_type": "markdown", 58 | "source": [ 59 | "OPTION 1: using model code (how-to video: https://youtu.be/vj-QrS_mWQI)" 60 | ], 61 | "metadata": { 62 | "id": "t3h7h9Cj3fyT" 63 | } 64 | }, 65 | { 66 | "cell_type": "code", 67 | "execution_count": null, 68 | "metadata": { 69 | "id": "sBbcB4vwj_jm" 70 | }, 71 | "outputs": [], 72 | "source": [ 73 | "# Change the model code below to our desired model(s), below are model code for Anygen x3.7\n", 74 | "!curl -Lo anygenv3.7.ckpt https://huggingface.co/nolanaatama/Anygen_v3.7/resolve/main/anygenz5.6.ckpt\n", 75 | "!curl -Lo anygenv3.7.vae.pt https://huggingface.co/nolanaatama/Anygen_v3.7/resolve/main/anygenz5.6.vae.pt\n", 76 | "!mv \"/content/anygenv3.7.ckpt\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 77 | "!mv \"/content/anygenv3.7.vae.pt\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 78 | "\n", 79 | "# model 2\n", 80 | "# !curl ...\n", 81 | "# !mv ...\n", 82 | "\n", 83 | "# model 3\n", 84 | "# !curl ...\n", 85 | "# !mv ..." 86 | ] 87 | }, 88 | { 89 | "cell_type": "markdown", 90 | "source": [ 91 | "OPTION 2: load model from Google Drive (how-to video: https://youtu.be/MwyfwPFezvY)" 92 | ], 93 | "metadata": { 94 | "id": "BZ8SPjKi3qUs" 95 | } 96 | }, 97 | { 98 | "cell_type": "code", 99 | "source": [ 100 | "# Change the file path below with our model path\n", 101 | "\n", 102 | "!cp \"/content/drive/MyDrive/mymodel/OURMODELNAME1.ckpt\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 103 | "\n", 104 | "# remove '#' from the beginning of these lines below and change the file path if we want to load more than one model\n", 105 | "# !cp \"/content/drive/MyDrive/mymodel/OURMODELNAME2.ckpt\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"\n", 106 | "# !cp \"/content/drive/MyDrive/mymodel/OURMODELNAME3.ckpt\" \"/content/stable-diffusion-webui/models/Stable-diffusion\"" 107 | ], 108 | "metadata": { 109 | "id": "bS81tISi4CRm" 110 | }, 111 | "execution_count": null, 112 | "outputs": [] 113 | }, 114 | { 115 | "cell_type": "markdown", 116 | "source": [ 117 | "# 3. Load our embeddings/textual inversions" 118 | ], 119 | "metadata": { 120 | "id": "lc5jJV9crd4C" 121 | } 122 | }, 123 | { 124 | "cell_type": "markdown", 125 | "source": [ 126 | "OPTION 1: choose individual emdeddings/textual inversion" 127 | ], 128 | "metadata": { 129 | "id": "OJx4QIQosMMq" 130 | } 131 | }, 132 | { 133 | "cell_type": "code", 134 | "source": [ 135 | "# Change the file path to our embeddings/textual inversion file path.\n", 136 | "# Remove the '#' from the beginning of the other lines to load additional files.\n", 137 | "\n", 138 | "!cp \"/content/drive/MyDrive/our_embeddings_textualinversion/OUREMBEDDINGTEXTUALINVERSION1.pt\" \"/content/stable-diffusion-webui/embeddings\"\n", 139 | "#!cp \"/content/drive/MyDrive/our_embeddings_textualinversion/OUREMBEDDINGTEXTUALINVERSION2.pt\" \"/content/stable-diffusion-webui/embeddings\"\n", 140 | "#!cp \"/content/drive/MyDrive/our_embeddings_textualinversion/OUREMBEDDINGTEXTUALINVERSION3.pt\" \"/content/stable-diffusion-webui/embeddings\"\n", 141 | "#!cp \"/content/drive/MyDrive/our_embeddings_textualinversion/OUREMBEDDINGTEXTUALINVERSION4.pt\" \"/content/stable-diffusion-webui/embeddings\"\n", 142 | "#!cp \"/content/drive/MyDrive/our_embeddings_textualinversion/OUREMBEDDINGTEXTUALINVERSION5.pt\" \"/content/stable-diffusion-webui/embeddings\"\n", 143 | "#!cp \"/content/drive/MyDrive/our_embeddings_textualinversion/OUREMBEDDINGTEXTUALINVERSION6.pt\" \"/content/stable-diffusion-webui/embeddings\"\n", 144 | "#!cp \"/content/drive/MyDrive/our_embeddings_textualinversion/OUREMBEDDINGTEXTUALINVERSION7.pt\" \"/content/stable-diffusion-webui/embeddings\"\n", 145 | "#!cp \"/content/drive/MyDrive/our_embeddings_textualinversion/OUREMBEDDINGTEXTUALINVERSION8.pt\" \"/content/stable-diffusion-webui/embeddings\"\n", 146 | "# ...." 147 | ], 148 | "metadata": { 149 | "id": "1E0f1kMTrGJ0" 150 | }, 151 | "execution_count": null, 152 | "outputs": [] 153 | }, 154 | { 155 | "cell_type": "markdown", 156 | "source": [ 157 | "OPTION 2: copy all embeddings/textual inversion file from google drive folder" 158 | ], 159 | "metadata": { 160 | "id": "47CPtGUfsar8" 161 | } 162 | }, 163 | { 164 | "cell_type": "code", 165 | "source": [ 166 | "# Remove the '#' from the '!cp -r ...' line and change the file path to our embeddings/textual inversion folder path.\n", 167 | "# The embeddings/textual inversion folder path must be ended with '/.' like '/folder/subfolder/.'\n", 168 | "\n", 169 | "#!cp -r '/content/drive/MyDrive/our_embeddings_textualinversion1/.' '/content/stable-diffusion-webui/embeddings'\n", 170 | "#!cp -r '/content/drive/MyDrive/our_embeddings_textualinversion2/.' '/content/stable-diffusion-webui/embeddings'\n", 171 | "#!cp -r '/content/drive/MyDrive/our_embeddings_textualinversion3/.' '/content/stable-diffusion-webui/embeddings'" 172 | ], 173 | "metadata": { 174 | "id": "dKmIwc3lsYR6" 175 | }, 176 | "execution_count": null, 177 | "outputs": [] 178 | }, 179 | { 180 | "cell_type": "markdown", 181 | "source": [ 182 | "# 4. Launch the web ui" 183 | ], 184 | "metadata": { 185 | "id": "6iCWJMUErmVa" 186 | } 187 | }, 188 | { 189 | "cell_type": "code", 190 | "source": [ 191 | "import shutil\n", 192 | "shutil.rmtree('/content/stable-diffusion-webui/embeddings')\n", 193 | "%cd /content/stable-diffusion-webui\n", 194 | "!git checkout 3715ece\n", 195 | "!git clone https://huggingface.co/nolanaatama/embeddings\n", 196 | "!COMMANDLINE_ARGS=\"--share --disable-safe-unpickle --no-half-vae --xformers --reinstall-xformers --enable-insecure-extension-access\" REQS_FILE=\"requirements.txt\" python launch.py" 197 | ], 198 | "metadata": { 199 | "id": "z5VT7rKtrcFy" 200 | }, 201 | "execution_count": null, 202 | "outputs": [] 203 | }, 204 | { 205 | "cell_type": "markdown", 206 | "metadata": { 207 | "id": "fhwIXzcgfkoR" 208 | }, 209 | "source": [ 210 | "# 📚 GitHub for more: [_@nolanaatama_](https://github.com/nolanaatama)\n", 211 | "# 📦 Repo: [Github](https://github.com/nolanaatama/sd-misc-colab)" 212 | ] 213 | } 214 | ], 215 | "metadata": { 216 | "accelerator": "GPU", 217 | "colab": { 218 | "provenance": [] 219 | }, 220 | "gpuClass": "standard", 221 | "kernelspec": { 222 | "display_name": "Python 3", 223 | "name": "python3" 224 | }, 225 | "language_info": { 226 | "name": "python" 227 | } 228 | }, 229 | "nbformat": 4, 230 | "nbformat_minor": 0 231 | } --------------------------------------------------------------------------------