├── .github └── workflows │ └── preview.yml ├── README.md ├── chilled_re-generic.md ├── lora_train.ipynb ├── prompts.md ├── stable_diffusion_1_5_webui.ipynb └── xformers_build.ipynb /.github/workflows/preview.yml: -------------------------------------------------------------------------------- 1 | name: Pull Request Preview 2 | on: 3 | pull_request: 4 | branches: [main] 5 | permissions: 6 | issues: write 7 | pull-requests: write 8 | jobs: 9 | preview: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v3 13 | with: 14 | ref: ${{ github.head_ref }} 15 | fetch-depth: 0 16 | - name: Get branch name 17 | id: get_branch_name 18 | run: echo ::set-output name=branch::${GITHUB_HEAD_REF} 19 | - name: Find Existing Comment 20 | uses: peter-evans/find-comment@v1 21 | id: fc 22 | with: 23 | issue-number: ${{ github.event.pull_request.number }} 24 | comment-author: 'github-actions[bot]' 25 | - name: Comment 26 | if: ${{ steps.fc.outputs.comment-id == 0 }} 27 | uses: peter-evans/create-or-update-comment@v1 28 | with: 29 | issue-number: ${{ github.event.pull_request.number }} 30 | body: | 31 | ## Preview 32 | [[Lora Train] Colab Preview](https://colab.research.google.com/github/wibus-wee/stable_diffusion_chilloutmix_ipynb/blob/${{ steps.get_branch_name.outputs.branch }}/lora_train.ipynb) 33 | 34 | [[Web UI] Colab Preview](https://colab.research.google.com/github/wibus-wee/stable_diffusion_chilloutmix_ipynb/blob/${{ steps.get_branch_name.outputs.branch }}/stable_diffusion_1_5_webui.ipynb) 35 | 36 | [[Xformers Build] Colab Preview](https://colab.research.google.com/github/wibus-wee/stable_diffusion_chilloutmix_ipynb/blob/${{ steps.get_branch_name.outputs.branch }}/xformers_build.ipynb) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ~~AUTOMATIC1111 Stable Diffusion WebUI 1.5 + Kohya's Scripts~~ (DEPRECIATED) 2 | 3 | ## DEPRECIATED 4 | 5 | > **Due to Google's increasing policy of blocking Stable Diffusion and my own lack of time to continue making this project available on Google Colab, the project will be discontinued for maintenance.** 6 | > 7 | > **However, you can also view the recommendations for some models in this repository and the collection of Prompts I maintained earlier.** 8 | 9 | _**How grateful I am to Google Colab for initially granting me the pleasure of experiencing the artistry of AI.**_ 10 | 11 | ## README 12 | 13 | ~~[[Web UI] Go To Colab](https://colab.research.google.com/github/wibus-wee/stable_diffusion_chilloutmix_ipynb/blob/main/stable_diffusion_1_5_webui.ipynb) | [[LoRA Train] Go To Colab](https://colab.research.google.com/github/wibus-wee/stable_diffusion_chilloutmix_ipynb/blob/main/lora_train.ipynb)~~ | [[Xformers Build] Go To Colab](https://colab.research.google.com/github/wibus-wee/stable_diffusion_chilloutmix_ipynb/blob/main/xformers_build.ipynb) | [Prompts Collection](/prompts.md) 14 | 15 | Now the download script of ["Recommended Loras"](#recommended-loras) and ["Recommended Checkpoints"](#recommended-checkpoints) has been built into the script (before startup), if you don't want to download it, you can disable them before startup. 16 | 17 | Most of the models are the latest versions from [CivitAI](https://civitai.com), but some LoRA models are marked with special versions, which are versions that I personally think are better. If you don't want to use this version, you may need to download other versions yourself (see below). 18 | 19 | If you want to download other models, you can go to the CivitAI tab in WebUI to download it yourself (if you have checked the install Civitai Browser extension option). In addition, remember to check the Save to Additional Network option. 20 | 21 | > **Warning**: Please note that there may be legal risks before painting. Please note whether your painting may cause controversy and negative impact on the development of the AI community. Please use it with caution. 22 | 23 | 24 | ## Roadmap 25 | 26 | - [x] ~~Paperspace Support~~ (Not considered in the future) 27 | - [x] Support for training LoRA Jupyter Notebook 28 | - [x] Optimize model download speed with aria2 29 | - [x] Internationalization 30 | - [x] Provide xformer support for Paperspace M4000 GPU 31 | - [x] Soft link LoRA in `models/Stable-diffusion` folder to Additional Network folder 32 | 33 | Jupyter Notebook's Language is still Chinese, I want to find a way to make it internationalized, but maintaining two versions is a bit troublesome, so I will do it later. 34 | 35 | ## About Training LoRA 36 | 37 | Basic training script based on [Akegarasu/lora-scripts](https://github.com/Akegarasu/lora-scripts) which is based on [kohya-ss/sd-scripts](https://github.com/kohya-ss/sd-scripts), but you can also use [ddPn08/kohya-sd-scripts-webui](https://github.com/ddPn08/kohya-sd-scripts-webui) which provides a GUI, it is more convenient, I also provide the corresponding SD WebUI extension installation method in `stable_diffusion_1_5_webui.ipynb`. 38 | 39 | Some models are not compatible with the training script, and the training script will not be able to train them. If you want to train them, you need to use the training script provided by the model author. 40 | 41 | > In [kohya-ss/sd-scripts train_network documentaion](https://github.com/kohya-ss/sd-scripts/blob/main/train_network_README-ja.md), it notes that the cloneofsimo's repository and the d8ahazard's Dreambooth Extension for Stable-Diffusion-WebUI are not compatible at the current time. This is because they have extended some features. 42 | 43 | ## Recommended Loras 44 | 45 | > It seems that the LoRA related to **@kbr** has disappeared, and I don't know the reason. Currently, you can find it at https://github.com/wibus-wee/stable_diffusion_chilloutmix_ipynb/releases/tag/koreanDollLikeness, I have uploaded it to the release. 46 | > 47 | > In addition, I have updated the startup script so that if you check install `koreanDollLikeness`, it will be installed automatically. 48 | 49 | - `(x1)` 🌟 St. Louis (Luxurious Wheels) (Azur Lane): https://civitai.com/models/6669/st-louis-luxurious-wheels-azur-lane 50 | - `(x1)` 👍 Girls' Frontline-OTs-14"lightning": https://civitai.com/models/6525/girls-frontline-ots-14lightning 51 | - `(x0.5)` 🌟 @kbr/Korean Doll Likeness: ~~https://civitai.com/models/7448/korean-doll-likeness~~ ( Has been re-uploaded to the release by me.) 52 | - `(x0.5)` 🆒 ~~@kbr/Japanese Doll Likeness: https://civitai.com/models/10135~~ 53 | - `(x0.5)` 🆒 ~~@kbr/Taiwan Doll Likeness : https://civitai.com/models/7716/taiwan-doll-likeness~~ 54 | - `(x0.5)` 🆒 Yae Miko | Realistic Genshin (Mixed): https://civitai.com/models/8484/yae-miko-or-realistic-genshin 55 | - `(x0.5)` 👍 Gakki | Aragaki Yui | 新垣結衣: https://civitai.com/models/8416/gakki-or-aragaki-yui-or 56 | - `(x0.5 - x1)` 🆒 ChilloutMixss: https://civitai.com/models/10850/chilloutmixss 57 | - `(x0.5)` 🆒 Cute_girl_mix4: https://civitai.com/models/14171/cutegirlmix4 58 | - `(x0.5)` 🆒 Fashion Girl (v4.5): https://civitai.com/models/8217/fashion-girl 59 | - `(x0.5)` 🆒 RandomCoser: https://huggingface.co/AzureKn1ght/RandomCoser (backup?) 60 | - 61 | > 🌟 - Very good, very recommended. 62 | > 63 | > 👍 - Good, recommended. 64 | > 65 | > 🆒 - Good. 66 | 67 | ## Recommended Checkpoints 68 | 69 | - [2.5D] ChilloutMix: https://civitai.com/models/6424/chilloutmix 70 | - [2.5D] SunshineMix: https://civitai.com/models/9291/sunshinemix 71 | - [2D] Grapefruit (hentai model): https://civitai.com/models/2583/grapefruit-hentai-model 72 | - [2.5D] Chilled_re_generic_v2: https://drive.google.com/file/d/1KNU_giorZYOflT3gdwAPtIPh6sNE2oNR/view?usp=sharing (merged by [wibus-wee](https://github.com/wibus-wee), recipe by [@sazyou_roukaku](https://twitter.com/sazyou_roukaku), recipe [See here](./chilled_re-generic.md) ) 73 | - [2D] Anything v4.5: https://huggingface.co/Airic/Anything-V4.5 74 | 75 | ## Recommended Textual Inversion 76 | 77 | - Ulzzang-6500 (Korean doll aesthetic): https://civitai.com/models/8109/ulzzang-6500-korean-doll-aesthetic 78 | - Pure Eros Face: https://civitai.com/models/4514/pure-eros-face 79 | 80 | ## Experimental LoRA 81 | 82 | Experimental LoRA refers to models that are not yet fully tested by me, and have not yet been determined to be compatible. If you want to use these models, please judge the compatibility with other LoRA by yourself. 83 | 84 | - liuyifei: https://civitai.com/models/8453/liuyifei 85 | - Lisa Blackpink: https://civitai.com/models/8605/lisa-blackpink 86 | - Jisoo Blackpink: https://civitai.com/models/8311/jisoo-blackpink 87 | - Rosè Blackpink: https://civitai.com/models/8600/rose-blackpink 88 | - MoXin: https://civitai.com/models/12597/moxin 89 | 90 | ## Experimental Checkpoints 91 | 92 | - GuoFeng3: https://civitai.com/models/10415/guofeng3 93 | 94 | ## NoteBook Built-in Extension 95 | 96 | WebUI Jupyter Notebook built-in Extension, you can install it directly from the notebook. 97 | 98 | - [deforum-art/deforum-for-automatic1111-webui](https://github.com/deforum-art/deforum-for-automatic1111-webui) 99 | - [AlUlkesh/stable-diffusion-webui-images-browser](https://github.com/Akegarasu/stable-diffusion-webui-images-browser) 100 | - [camenduru/stable-diffusion-webui-huggingface](https://github.com/camenduru/stable-diffusion-webui-huggingface) 101 | - [camenduru/sd-civitai-browser](https://github.com/camenduru/sd-civitai-browser) 102 | - [camenduru/openpose-editor](https://github.com/camenduru/openpose-editor) 103 | - [Mikubill/sd-webui-controlnet](https://github.com/Mikubill/sd-webui-controlnet) 104 | - [kohya-ss/sd-webui-additional-networks](https://github.com/kohya-ss/sd-webui-additional-networks) 105 | - [ddpn08/kohya-sd-scripts-webui](https://github.com/ddpn08/kohya-sd-scripts-webui) *(This extension has better install before WebUI Starting, otherwise you need to restart Application instead of just reload the UI.)* 106 | - [d8ahazard/sd_dreambooth_extension](https://github.com/d8ahazard/sd_dreambooth_extension) 107 | 108 | ## Build xformers from source 109 | 110 | If you are using Google Colab, there are many precompiled wheels for you to choose from. If you are using something else or want to build from source, you can use this notebook to build the library. 111 | 112 | I have written a [notebook](./xformers_build.ipynb) to build xformers from source. You can use it to build xformers for your own GPU. 113 | 114 | ## CHANGELOG 115 | 116 | ### 2023.6.23 117 | 118 | - **stable_diffusion_1_5_webui.ipynb** 119 | - Bypass colab detection [#20](https://github.com/wibus-wee/stable-diffusion-webui-ipynb/pull/20) 120 | 121 | ### 2023.4.10 122 | 123 | - **stable_diffusion_1_5_webui.ipynb** 124 | - Upgrade webui version 125 | - Upgrade some extensions' version 126 | - Change some extensions git url to original repo 127 | 128 | ### 2023.4.9 129 | 130 | - **stable_diffusion_1_5_webui.ipynb** 131 | - Change `KoreanDollLikeness` download url to @kanbara's huggingface model 132 | - Add `KoreanDollLikeness v2` model 133 | - Fix PyTorch and torchvision version conflict problem [#17](https://github.com/wibus-wee/stable-diffusion-webui-ipynb/issues/17) 134 | 135 | ### 2023.4.8 136 | 137 | - **stable_diffusion_1_5_webui.ipynb** 138 | - Download Lora into official model directory instead of the plugin directory 139 | - Soft link the lora models to the Additional Network plugin directory 140 | 141 | ### 2023.4.2 142 | 143 | - **stable_diffusion_1_5_webui.ipynb** 144 | - Support input custom lora download url 145 | 146 | ### 2023.3.25 147 | 148 | - **stable_diffusion_1_5_webui.ipynb** 149 | - Use the wrong list to cause the Textual Inversion download to fail 150 | - Only soft link the model once, remove the `!rm -rf stable_diffusion/model/Lora` step to avoid accidentally deleting other models 151 | 152 | ### 2023.3.18 153 | 154 | - **lora_train.ipynb** 155 | - Language Internationalization 156 | - **stable_diffusion_1_5_webui.ipynb** 157 | - Support [Cloudfared](https://github.com/cloudflare/cloudflared) as a Tunnel Client 158 | 159 | ### 2023.3.8 160 | 161 | - **README** 162 | - Modify Chilled_re_generic_v2 link to Google Drive Share Link 163 | - Set `Chilloutmixss` model to deprecated (This model is disappeared.) 164 | - **stable_diffusion_1_5_webui.ipynb** 165 | - Remove `Chilloutmixss` model option 166 | - Use `try-except` to catch `KeyError` when downloading models. 167 | - Support download `styles.csv` with url. 168 | 169 | ### 2023.3.4 170 | 171 | - **README** 172 | - Add Chilled_re_generic_v2 download link 173 | - **stable_diffusion_1_5_webui.ipynb** 174 | - Support custom checkpoint name ( From custom url ) 175 | 176 | ### 2023.3.5 177 | 178 | - **stable_diffusion_1_5_webui.ipynb** 179 | - Custom checkpoint version 180 | - Missing return value 181 | - API argument support 182 | - Fixed xformer not starting on M4000 GPU platforms with xformer installed 183 | - Support download multiple checkpoints at the same time 184 | - Support download checkpoints from other URLs 185 | 186 | ### 2023.3.4 187 | 188 | - **stable_diffusion_1_5_webui.ipynb** 189 | - Download `koreanDollLikeness` model with GitHub Release API 190 | - Soft link LoRA models so that they can be used in prompts and additional networks. (Only operate before startup, the LoRA installed after startup may not be used in prompts. You need to restart the application to re-link the models installed in other networks.) 191 | - Provides the option to install LoRA before startup 192 | - Get the latest checkpoint download address from the CivitAI API 193 | - Support for entering custom checkpoint id 194 | - Define download functions to optimize readability 195 | - Support LoRA specific version selection in download function 196 | - Auto detect download tool 197 | - Textual Inversion download function 198 | - **README.md** 199 | - Update "Experimental Checkpoints" and "Experimental LoRA" section 200 | - **prompts.md** 201 | - Add a new prompt `Basic Tiara` 202 | 203 | ### 2023.2.25 204 | 205 | - **README.md** 206 | - Update Experimental Lora List - Add `ChilloutMixss` 207 | - Optimize CHANGELOG format 208 | - Internationalize README 209 | - New "Textual Inversion" section 210 | - Add "NoteBook Built-in Extension" section 211 | - Add "Build xformers from source" section 212 | - **lora_train.ipynb** 213 | - Fix serious errors in LoRA training script 214 | - Remove unnecessary platform and GPU checks 215 | - Add `export_model_dir` option to specify the directory where the model is exported 216 | - Add an extra build installation xformers option for the M4000 GPU 217 | - Use `ninja` to build xformers much faster ( Followed by Official README) 218 | - **stable_diffusion_1_5_webui.ipynb** 219 | - Add an extra build installation xFormer option for the M4000 GPU 220 | - Use `ninja` to build xformers much faster ( Followed by Official README) 221 | - **prompts.md** 222 | - Internationalize 223 | - **xformers_build.ipynb** 224 | - New xformers build script 225 | - Switch xformers source version to 0.0.16 226 | - **workflows** 227 | - Add `xformers_build.ipynb` to Preview CI 228 | - Remove `pull_request_target` value to prevent the workflow from running twice 229 | - **Release** 230 | - Publish xformers precompiled wheels for M4000 GPU 231 | 232 | ### 2023.2.24 233 | 234 | - **workflows** 235 | - Automatically comment on Preview link when Pull Request ( https://github.com/wibus-wee/stable_diffusion_chilloutmix_ipynb/pull/2 ) 236 | - **stable_diffusion_1_5_webui.ipynb** 237 | - Install controlnet, openpose-editor, Kohya sd-scripts extension with Stable-Diffusion-WebUI 238 | - Remove the old training model installation scheme and merge it into the installation steps ( created in 2023.2.19 ) 239 | - **lora_train.ipynb** 240 | - New Lora Train Script ( Alpha ) 241 | 242 | ### 2023.2.21 243 | 244 | - **stable_diffusion_1_5_webui.ipynb** 245 | - Better option selection mechanism 246 | - Fine distinction between Paperspace and Colab platforms rather than relying on a single Free GPU model 247 | 248 | ### 2023.2.19 249 | 250 | - **stable_diffusion_1_5_webui.ipynb** 251 | - Fix the problem of incorrectly identifying the Quadro M4000 GPU 252 | - Add **Training Model** Installation Scheme ( Power by [d8ahazard/sd_dreambooth_extension](https://github.com/d8ahazard/sd_dreambooth_extension)) 253 | - Optimize checkpoint selection 254 | - Fix the problem of not being able to read variables 255 | - Automatically check whether webUI and training extensions are installed 256 | 257 | ### 2023.2.18 258 | 259 | - **stable_diffusion_1_5_webui.ipynb** 260 | - Update the latest version of the upstream ChilloutMix 261 | - Update Prompts Collection 262 | - Compatible with Paperspace platform (Free GPU) 263 | - Export all generated images 264 | - Use `nvidia-smi` to view GPU information 265 | - Check if GPU supports Xformers 266 | - Optimize variable passing 267 | 268 | ### 2023.2.17 269 | 270 | - **stable_diffusion_1_5_webui.ipynb** 271 | - Add SunshineMix Checkpoint as a second choice for 2.5D painting 272 | 273 | ### 2023.2.16 274 | - **stable_diffusion_1_5_webui.ipynb** 275 | - Because there may be a sudden exit in the middle, there is another way to restart 276 | 277 | --- 278 | 279 | > Created by [@wibus-wee](https://github.com/wibus-wee) 280 | > 281 | > Reference: [camenduru/stable-diffusion-webui-colab](https://github.com/camenduru/stable-diffusion-webui-colab) 282 | -------------------------------------------------------------------------------- /chilled_re-generic.md: -------------------------------------------------------------------------------- 1 | # Chilled_re_generic_v2 Checkpoint 2 | 3 | > By [@sazyou_roukaku](https://twitter.com/sazyou_roukaku) 4 | > 5 | > Origin: https://twitter.com/sazyou_roukaku/status/1631603598894436352 6 | 7 | ## Recipe 8 | 9 | museV1_v1:`0.4` + (Basil_mix_fixed:`0.3 `+ (lofi_V1Fp16:`0.5 `+ colorful_v13) + VAE) 10 | 11 | ## Steps 12 | 13 | ```mermaid 14 | graph TD; 15 | lofi_V1Fp16:0.5 --- colorful_v13 --> LoFIColorFul_merged 16 | Basil_mix_fixed:0.3 --- LoFIColorFul_merged -- vae-ft-mse-840000 --> BasilLoFIColorFul_merged 17 | museV1_v1:0.4 --- BasilLoFIColorFul_merged --> Chilled_re_generic_v2 18 | 19 | ``` 20 | 21 | ## Related Links 22 | 23 | ・[museV1_v1](https://civitai.com/models/13564/musev1) 24 | 25 | ・[Basil_mix_fixed](https://huggingface.co/nuigurumi/basil_mix/tree/main) 26 | 27 | ・[lofi_V1Fp16](https://civitai.com/models/9052/lofi) 28 | 29 | ・[colorful_v13](https://civitai.com/models/7279/colorful) 30 | 31 | ・[vae-ft-mse-840000](https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.ckpt) -------------------------------------------------------------------------------- /lora_train.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "attachments": {}, 5 | "cell_type": "markdown", 6 | "metadata": {}, 7 | "source": [ 8 | "# Kohya's Script + Lora Train\n", 9 | "\n", 10 | "**Another Choice**: https://github.com/ddPn08/kohya-sd-scripts-webui\n", 11 | "\n", 12 | "More info: https://github.com/wibus-wee/stable_diffusion_chilloutmix_ipynb\n", 13 | "\n", 14 | "> Created by [@wibus-wee](https://github.com/wibus-wee)\n", 15 | ">\n", 16 | "> Reference: [camenduru/stable-diffusion-webui-colab](https://github.com/camenduru/stable-diffusion-webui-colab)" 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": null, 22 | "metadata": {}, 23 | "outputs": [], 24 | "source": [ 25 | "from IPython.display import display\n", 26 | "import ipywidgets as widgets\n", 27 | "import requests\n", 28 | "\n", 29 | "#@title Choose checkpoint { display-mode: \"form\" }\n", 30 | "endpoint = 'https://civitai.com/api/v1/models'\n", 31 | "#@markdown Checkpoint( If you want to use your own model, please select \"others\" and fill in the \"Other checkpoint\" below.)\n", 32 | "checkpointName = 'Chilloutmix' #@param [\"Chilloutmix\", \"Sunshinemix\", \"grapefruit_hentai\", \"others\"]\n", 33 | "#@markdown Other checkpoint (Checkpoint ID in civitai , only support one model)\n", 34 | "checkpointID = '' #@param {type:\"string\"}\n", 35 | "#@markdown Other checkpoint (Checkpoint download URL, only support one model)\n", 36 | "checkpointURL = '' #@param {type:\"string\"}\n", 37 | "\n", 38 | "\n", 39 | "defaultCheckpoint = {\n", 40 | " 'Chilloutmix': '6424',\n", 41 | " 'Sunshinemix': '9291',\n", 42 | " 'grapefruit_hentai': '2583'\n", 43 | "}\n", 44 | "\n", 45 | "downloadIds = []\n", 46 | "\n", 47 | "if checkpointID != '':\n", 48 | " downloadIds = checkpointID.split(',')\n", 49 | "if checkpointName != 'others':\n", 50 | " downloadIds.append(defaultCheckpoint[checkpointName])\n", 51 | "\n", 52 | "globalDropdowns = []\n", 53 | "globalVerions = []\n", 54 | "globalNames = []\n", 55 | "globalTexts = []\n", 56 | "checkpoints = []\n", 57 | "downloadLinks = []\n", 58 | "\n", 59 | "def text_on_submit(change):\n", 60 | " checkpoints[checkpoints.index(change['old'])] = change['new']\n", 61 | "\n", 62 | "if checkpointURL != '':\n", 63 | " _downloadLinks = checkpointURL.split(',')\n", 64 | " for _downloadLink in _downloadLinks:\n", 65 | " checkpoints.append(_downloadLink.split('/')[-1])\n", 66 | " downloadLinks.append(_downloadLink)\n", 67 | " text = widgets.Text(value=_downloadLink.split('/')[-1], description=_downloadLink.split('/')[-1], disabled=False)\n", 68 | " text.observe(text_on_submit, names='value')\n", 69 | " form = widgets.VBox([text])\n", 70 | " display(form)\n", 71 | "\n", 72 | "def showVerionOptions(downloadId):\n", 73 | " res = requests.get(endpoint + '/' + downloadId).json()\n", 74 | " globalNames.append(res['name'])\n", 75 | " versions = res['modelVersions']\n", 76 | " globalVerions.append(versions)\n", 77 | " options = []\n", 78 | " for version in versions:\n", 79 | " options.append(version['files'][0]['name'])\n", 80 | " dropdown = widgets.Dropdown(options=options, description=res['name'])\n", 81 | " globalDropdowns.append(dropdown)\n", 82 | " form = widgets.VBox([dropdown])\n", 83 | " display(form)\n", 84 | "\n", 85 | "for downloadId in downloadIds:\n", 86 | " showVerionOptions(downloadId)\n", 87 | "\n", 88 | "def on_button_clicked(b):\n", 89 | " downloadLink = None\n", 90 | " for dropdown in globalDropdowns:\n", 91 | " checkpoint = dropdown.value\n", 92 | " versions = globalVerions[globalDropdowns.index(dropdown)]\n", 93 | " for version in versions:\n", 94 | " if version['files'][0]['name'] == checkpoint:\n", 95 | " downloadLink = version['files'][0]['downloadUrl']\n", 96 | " break\n", 97 | " if downloadLink is None:\n", 98 | " print('Error: downloadLink not assigned')\n", 99 | " return\n", 100 | " checkpoints.append(checkpoint)\n", 101 | " downloadLinks.append(downloadLink)\n", 102 | "\n", 103 | " print(\"Checkpoint \" + str(checkpoints) + \" <===> \" + str(downloadLinks))\n", 104 | " %store checkpoint\n", 105 | " %store downloadLink\n", 106 | "\n", 107 | "\n", 108 | "button = widgets.Button(description='Use it!')\n", 109 | "button.on_click(on_button_clicked)\n", 110 | "display(button)" 111 | ] 112 | }, 113 | { 114 | "cell_type": "code", 115 | "execution_count": null, 116 | "metadata": {}, 117 | "outputs": [], 118 | "source": [ 119 | "#@title 0. Check GPU & Check Environment { display-mode: \"form\" }\n", 120 | "\n", 121 | "#@markdown This step will check if your GPU is supported by xformers, and check if you are using Paperspace (only M4000 GPU is checked, so paid GPUs may have logical errors here, you may need to check the \"isPaperspace\" checkbox manually).\n", 122 | "\n", 123 | "import os, subprocess\n", 124 | "paperspace_m4000 = False\n", 125 | "#@markdown ⬇️ True: Paperspace | False: Colab\n", 126 | "isPaperspace = False #@param {type:\"boolean\"}\n", 127 | "try:\n", 128 | " subprocess.run(['nvidia-smi', '--query-gpu=name', '--format=csv,noheader'], stdout=subprocess.PIPE)\n", 129 | " if 'M4000' in subprocess.run(['nvidia-smi', '--query-gpu=name', '--format=csv,noheader'], stdout=subprocess.PIPE).stdout.decode('utf-8'):\n", 130 | " print(\"WARNING: You are using Quadro M4000 GPU, which will not be able to use xformers.\")\n", 131 | " paperspace_m4000 = True\n", 132 | " isPaperspace = True\n", 133 | " else:\n", 134 | " print(\"You are using a suitable GPU - \" + subprocess.run(['nvidia-smi', '--query-gpu=name', '--format=csv,noheader'], stdout=subprocess.PIPE).stdout.decode('utf-8') + \".\"\n", 135 | "except:\n", 136 | " print(\"The GPU is not available. Please check your runtime type.\")\n", 137 | " exit()\n", 138 | "\n", 139 | "rootDir = isPaperspace and '/tmp' or '/content'\n", 140 | "\n", 141 | "%store rootDir\n", 142 | "%store paperspace_m4000 \n", 143 | "%store isPaperspace" 144 | ] 145 | }, 146 | { 147 | "cell_type": "code", 148 | "execution_count": null, 149 | "metadata": {}, 150 | "outputs": [], 151 | "source": [ 152 | "#@title 1. Install Dependencies\n", 153 | "\n", 154 | "#@markdown ⬇️ True: Install xformers | False: Skip (Only for Paperspace M4000 GPU, if you choose this option, xformers will be installed from source code)\n", 155 | "xformersInstall = True #@param {type:\"boolean\"}\n", 156 | "\n", 157 | "%store -r rootDir \n", 158 | "%store -r checkpoint\n", 159 | "%store -r downloadLink\n", 160 | "%store -r paperspace_m4000\n", 161 | "\n", 162 | "!apt-get -y install -qq aria2\n", 163 | "ariaInstalled = False\n", 164 | "\n", 165 | "try:\n", 166 | " subprocess.run(['aria2c', '--version'], stdout=subprocess.PIPE)\n", 167 | " ariaInstalled = True\n", 168 | "except:\n", 169 | " pass\n", 170 | "\n", 171 | "!git clone --recurse-submodules https://github.com/Akegarasu/lora-scripts {rootDir}/lora-scripts\n", 172 | "\n", 173 | "%cd {rootDir}/lora-scripts\n", 174 | "if ariaInstalled:\n", 175 | " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {downloadLink} -d {rootDir}/lora-scripts/sd-models -o {checkpoint}\n", 176 | "else:\n", 177 | " !wget -c {downloadLink} -P {rootDir}/stable-diffusion-webui/models/Stable-diffusion -O {rootDir}/lora-scripts/sd-models/{checkpoint}\n", 178 | "\n", 179 | "\n", 180 | "!echo \"Installing deps...\"\n", 181 | "%cd ./sd-scripts\n", 182 | "!pip install torch==1.13.1+cu116 torchvision==0.14.1+cu116 --extra-index-url https://download.pytorch.org/whl/cu116\n", 183 | "!pip install --upgrade -r requirements.txt\n", 184 | "if paperspace_m4000:\n", 185 | " if xformersInstall:\n", 186 | " !pip install ninja\n", 187 | " !pip install -v -U git+https://github.com/facebookresearch/xformers.git@main#egg=xformers\n", 188 | " !pip install --pre triton\n", 189 | "else:\n", 190 | " !pip install -q https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.16/xformers-0.0.16+814314d.d20230118-cp38-cp38-linux_x86_64.whl\n", 191 | " !pip install --pre triton\n", 192 | "!pip install --upgrade lion-pytorch\n", 193 | "\n", 194 | "echo \"Install completed\"" 195 | ] 196 | }, 197 | { 198 | "cell_type": "code", 199 | "execution_count": null, 200 | "metadata": {}, 201 | "outputs": [], 202 | "source": [ 203 | "#@title 2. Setup Training Options\n", 204 | "%store -r rootDir \n", 205 | "%store -r checkpoint \n", 206 | "\n", 207 | "!source venv/bin/activate\n", 208 | "\n", 209 | "#@markdown 底膜路径 - 已跟随 Checkpoint 设置 | Pretrained model path - Followed by Checkpoint\n", 210 | "pretrained_model = rootDir + \"/lora-scripts/sd-models/\" + checkpoint\n", 211 | "#@markdown 训练数据集路径 | Training dataset path\n", 212 | "#@markdown PaperSpace 如果是在 Files 上传文件请加入 /notebooks/ 前缀,在 Google Colab 请加入 /content/ 前缀\n", 213 | "#@markdown If you upload the file to Files in PaperSpace, please add the /notebooks/ prefix. If you upload the file to Google Colab, please add the /content/ prefix.\n", 214 | "train_data_dir = \"/\" #@param {type:\"string\"}\n", 215 | "#@markdown 导出模型路径 | Export model path\n", 216 | "#@markdown PaperSpace 如果是在 Files 上传文件请加入 /notebooks/ 前缀,在 Google Colab 请加入 /content/ 前缀\n", 217 | "#@markdown If you upload the file to Files in PaperSpace, please add the /notebooks/ prefix. If you upload the file to Google Colab, please add the /content/ prefix.\n", 218 | "export_model_dir = \"/\" #@param {type:\"string\"}\n", 219 | "#@markdown 模型保存名称 | output model name\n", 220 | "output_name = \"lora_v1.0\" #@param {type:\"string\"}\n", 221 | "#@markdown 模型保存格式 | model save ext (ckpt, pt, safetensors)\n", 222 | "save_model_as = \"safetensors\" #@param [\"ckpt\", \"pt\", \"safetensors\"] {type:\"string\"}\n", 223 | "#@markdown 图片分辨率 | image resolution\n", 224 | "#@markdown (宽,高). 支持非正方形,但必须是 64 倍数。 | (width, height). Non-square images are supported, but must be a multiple of 64.\n", 225 | "resolution = \"512,512\" #@param [\"256,256\", \"512,512\", \"1024,1024\", \"2048,2048\"]\n", 226 | "#@markdown batch size | 批大小\n", 227 | "batch_size = 1 #@param {type:\"number\"}\n", 228 | "#@markdown max train epoches | 最大训练 epoch\n", 229 | "max_train_epoches = 10 #@param {type:\"number\"}\n", 230 | "#@markdown save every n epochs | 每 N 个 epoch 保存一次\n", 231 | "save_every_n_epochs = 2 #@param {type:\"number\"}\n", 232 | "#@markdown network dim | 常用 4~128,不是越大越好 | A value between 4 and 128. Not necessarily the larger the better.\n", 233 | "network_dim = 32 #@param {type:\"number\"}\n", 234 | "#@markdown network alpha\n", 235 | "#@markdown 常用与 network_dim 相同的值或者采用较小的值,如 network_dim的一半 防止下溢。默认值为 1,使用较小的 alpha 需要提升学习率。\n", 236 | "#@markdown A value between 1 and network_dim. Not necessarily the larger the better. Default value is 1. Use a smaller alpha value to prevent underflow. You may need to increase the learning rate.\n", 237 | "network_alpha = 32 #@param {type:\"number\"}\n", 238 | "#@markdown clip skip | 玄学 一般用 2 | Usually 2.\n", 239 | "clip_skip = 2 #@param {type:\"number\"}\n", 240 | "#@markdown train U-Net only | 仅训练 U-Net,开启这个会牺牲效果大幅减少显存使用。6G显存可以开启 | This will sacrifice the quality of the model, but it will reduce the memory usage. 6G GPU memory can be enabled.\n", 241 | "train_unet_only = False #@param {type:\"boolean\"}\n", 242 | "#@markdown train Text Encoder only | 仅训练 文本编码器\n", 243 | "train_text_encoder_only = False #@param {type:\"boolean\"}\n", 244 | "#@markdown 学习率 | Learning rate\n", 245 | "lr = \"1e-4\" #@param {type:\"string\"}\n", 246 | "#@markdown unet_lr | U-Net 学习率 | Learning rate of the U-Net\n", 247 | "unet_lr = \"1e-4\" #@param {type:\"string\"}\n", 248 | "#@markdown text_encoder_lr | 文本编码器学习率 | Learning rate of the text encoder\n", 249 | "text_encoder_lr = \"1e-5\" #@param {type:\"string\"}\n", 250 | "#@markdown lr_scheduler | \"linear\", \"cosine\", \"cosine_with_restarts\", \"polynomial\", \"constant\", \"constant_with_warmup\"\n", 251 | "lr_scheduler = \"cosine_with_restarts\" #@param [\"linear\", \"cosine\", \"cosine_with_restarts\", \"polynomial\", \"constant\", \"constant_with_warmup\"] {type:\"string\"}\n", 252 | "#@markdown lr_warmup_steps | 仅在 lr_scheduler 为 constant_with_warmup 时需要填写这个值 | Only needed when lr_scheduler is constant_with_warmup\n", 253 | "lr_warmup_steps = 0 #@param {type:\"number\"}\n", 254 | "#@markdown 若需要从已有的 LoRA 模型上继续训练,请填写 LoRA 模型路径。 | If you want to continue training from an existing LoRA model, please fill in the LoRA model path.\n", 255 | "network_weights = \"\" #@param {type:\"string\"}\n", 256 | "#@markdown arb min resolution | arb 最小分辨率\n", 257 | "min_bucket_reso = 256 #@param {type:\"number\"}\n", 258 | "#@markdown arb max resolution | arb 最大分辨率\n", 259 | "max_bucket_reso = 1024 #@param {type:\"number\"}\n", 260 | "#@markdown persistent dataloader workers | 容易爆内存,保留加载训练集的worker,减少每个 epoch 之间的停顿 | Persistent dataloader workers, reduce the pause between each epoch\n", 261 | "persistent_data_loader_workers = 0 #@param {type:\"number\"}\n", 262 | "#@markdown use 8bit adam optimizer | 使用 8bit adam 优化器节省显存,默认启用。部分 10 系老显卡无法使用,修改为 0 禁用。 | Use 8bit adam optimizer to save memory. Default is enabled. Some 10 series old GPUs cannot use it. Set to 0 to disable.\n", 263 | "use_8bit_adam = True #@param {type:\"boolean\"}\n", 264 | "#@markdown use lion optimizer | 使用 Lion 优化器 | Use Lion optimizer\n", 265 | "use_lion = False #@param {type:\"boolean\"}" 266 | ] 267 | }, 268 | { 269 | "cell_type": "code", 270 | "execution_count": null, 271 | "metadata": {}, 272 | "outputs": [], 273 | "source": [ 274 | "#@title 4. Start training\n", 275 | "!accelerate launch --num_cpu_threads_per_process=8 \"./sd-scripts/train_network.py\" \\\n", 276 | " --enable_bucket \\\n", 277 | " --pretrained_model_name_or_path=$pretrained_model \\\n", 278 | " --train_data_dir=$train_data_dir \\\n", 279 | " --output_dir=$export_model_dir \\\n", 280 | " --logging_dir=\"/tmp/logs\" \\\n", 281 | " --resolution=$resolution \\\n", 282 | " --network_module=networks.lora \\\n", 283 | " --max_train_epochs=$max_train_epoches \\\n", 284 | " --learning_rate=$lr \\\n", 285 | " --unet_lr=$unet_lr \\\n", 286 | " --text_encoder_lr=$text_encoder_lr \\\n", 287 | " --lr_scheduler=$lr_scheduler \\\n", 288 | " --lr_warmup_steps=$lr_warmup_steps \\\n", 289 | " --network_dim=$network_dim \\\n", 290 | " --network_alpha=$network_alpha \\\n", 291 | " --output_name=$output_name \\\n", 292 | " --train_batch_size=$batch_size \\\n", 293 | " --save_every_n_epochs=$save_every_n_epochs \\\n", 294 | " --mixed_precision=\"fp16\" \\\n", 295 | " --save_precision=\"fp16\" \\\n", 296 | " --seed=\"1337\" \\\n", 297 | " --cache_latents \\\n", 298 | " --clip_skip=$clip_skip \\\n", 299 | " --prior_loss_weight=1 \\\n", 300 | " --max_token_length=225 \\\n", 301 | " --caption_extension=\".txt\" \\\n", 302 | " --save_model_as=$save_model_as \\\n", 303 | " --min_bucket_reso=$min_bucket_reso \\\n", 304 | " --max_bucket_reso=$max_bucket_reso \\\n", 305 | " --use_8bit_adam=$use_8bit_adam \\\n", 306 | " --shuffle_caption --xformer" 307 | ] 308 | } 309 | ], 310 | "metadata": { 311 | "language_info": { 312 | "name": "python" 313 | }, 314 | "orig_nbformat": 4 315 | }, 316 | "nbformat": 4, 317 | "nbformat_minor": 2 318 | } 319 | -------------------------------------------------------------------------------- /prompts.md: -------------------------------------------------------------------------------- 1 | # Prompts Collections - 标签集合 2 | 3 | 先介绍两种标签: 4 | 5 | - **SFW**: Safe For Work - 较为安全 6 | - **NSFW**: Not Safe For Work - **不安全 请勿在有客人的地方打开此类图片** 7 | 8 | This is a collection of prompts for generating images. Most of the prompts are `SFW`, but some of the prompts are not `SFW` in the negative prompts. 9 | 10 | The generated images often have facial defects, and the problem of large hands and feet needs to be added with appropriate negative prompts, which cannot completely suppress the appearance of wrong hands and feet. 11 | 12 | ## Table of Contents 13 | 14 | - [\[SFW\] Cat ears + Blue eyes](#sfw-cat-ears--blue-eyes) 15 | - [[SFW\] Blue long hair + Silver dress](#sfw-blue-long-hair--silver-dress) 16 | - [\[SFW\] School uniform](#sfw-school-uniform) 17 | - [\[SFW\] Side ponytail + Multicolored hair](#sfw-side-ponytail--multicolored-hair) 18 | - [\[SFW\] Sleeveless white](#sfw-sleeveless-white) 19 | - [\[SFW\] Redgown](#sfw-redgown) 20 | - [\[NSFW\] Seductive pose](#nsfw-seductive-pose) 21 | - [\[SFW\] White sports bra + Outdoors](#sfw-white-sports-bra--outdoors) 22 | - [\[SFW\] Blue long & elbow dress](#sfw-blue-long--elbow-dress) 23 | - [\[SFW\] Platinum blonde hair + Black skirt](#sfw-platinum-blonde-hair--black-skirt) 24 | - [\[SFW\] Black tight suit + Cyberpunk city](#sfw-black-tight-suit--cyberpunk-city) 25 | - [\[SFW\] Basic Tiara](#sfw-basic-tiara) 26 | 27 | ## Tips 28 | 29 | - Lora _stLouisLuxuriousWheels_v1_ Weight = **1** - Default 30 | - Lora _koreanDollLikeness_v10_ Weight = **0.5** - If you set the weight more than 1, it will cause the face to be deformed. It is recommended to set the weight to 0.5, if you want to set it to 1, you can try to set it to 0.66 31 | - Sampler - **DPM++ 2M Karras** or **DPM++ SDE Karras**,I use DPM++ 2M Karras more often 32 | - Steps **25**,and the image will be more stable 33 | - CFG scale - **7** 34 | - stLouisLuxuriousWheels or girlsFrontlineOts14 **only open one**, if you open more than one, it may cause the picture to be mixed up and unorganized 35 | - ChilloutMix seems to draw large breasts most of the time, so it is necessary to add the `large breasts` tag when necessary to suppress it 36 | - Lora _koreanDollLikeness_v10_ and Lora _koreanDollLikeness_v15_ have some different in drawing, so you can try to use them alternately, they have no conflict with each other. 37 | 38 | ## [SFW] Cat ears + Blue eyes 39 | 40 |
41 |

Demo 案例

42 | 43 |
44 | 45 | ### Prompts 提示标签 46 | 47 | ``` 48 | best quality, ultra high res, (photorealistic:1.4), 1 white child, (ulzzang-6500:1.0), smiling, (PureErosFace_V1:1.0), ((detailed facial features)), alluring blue eyes, photographed on a Canon EOS R5, 50mm lens, F/2.8, HDR, 8k resolution, ulzzang-6500, (kpop idol), aegyo sal, from side, looking at camera, cat ears, sports bra, 49 | ``` 50 | 51 | ### Negative prompts 反向提示标签 52 | 53 | ``` 54 | paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans 55 | ``` 56 | 57 | ### Others 其他 58 | 59 | - Steps: 25 60 | - Sampler: DPM++ 2M Karras 61 | - CFG scale: 7 62 | - Size: 512x512 63 | - Model: chilloutmix 64 | - AddNet Enabled: True 65 | - AddNet Module 1: LoRA, AddNet Model 1: koreanDollLikeness_v10(e2e472c06607), AddNet Weight A 1: 0.5, AddNet Weight B 1: 0.5, 66 | - AddNet Module 2: LoRA, AddNet Model 2: stLouisLuxuriousWheels_v1(034b97419349), AddNet Weight A 2: 1, AddNet Weight B 2: 1 67 | 68 | ## [SFW] Blue long hair + Silver dress 69 | 70 | 71 |
72 |

Demo 案例

73 | 74 |
75 | 76 | 77 | ### Prompts 提示标签 78 | 79 | ``` 80 | best quality, blue long hair, ultra high res, (photorealistic:1.4), 1girl,silver dress 81 | ``` 82 | 83 | ### Negative prompts 反向提示标签 84 | 85 | ``` 86 | EasyNegative, paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans,extra fingers,fewer fingers, 87 | ``` 88 | 89 | ### Others 其他 90 | 91 | - Steps: 25, 92 | - Sampler: DPM++ 2M Karras, 93 | - CFG scale: 7, 94 | - Model: chilloutmix, 95 | - AddNet Enabled: True, 96 | - AddNet Module 1: LoRA, AddNet Model 1: koreanDollLikeness_v10(e2e472c06607), AddNet Weight A 1: 0.5, AddNet Weight B 1: 0.5, 97 | - AddNet Module 2: LoRA, AddNet Model 2: stLouisLuxuriousWheels_v1(034b97419349), AddNet Weight A 2: 1, AddNet Weight B 2: 1 98 | 99 | ## [SFW] School uniform 100 | 101 | 102 |
103 |

Demo 案例

104 | 105 |
106 | 107 | 108 | ### Prompts 提示标签 109 | 110 | ``` 111 | best quality, ultra high res, (photorealistic:1.4), 1girl,school uniform,cute,(platinum blonde grey hair:1), ((puffy eyes)), looking at viewer, full body 112 | ``` 113 | 114 | ### Negative prompts 反向提示标签 115 | 116 | ``` 117 | paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans, nsfw, 118 | ``` 119 | 120 | ### Others 其他 121 | 122 | - Steps: 25, 123 | - Sampler: DPM++ 2M Karras, 124 | - CFG scale: 7, 125 | - Model: chilloutmix, 126 | - AddNet Enabled: True, 127 | - AddNet Module 1: LoRA, AddNet Model 1: koreanDollLikeness_v10(e2e472c06607), AddNet Weight A 1: 0.5, AddNet Weight B 1: 0.5, 128 | - AddNet Module 2: LoRA, AddNet Model 2: stLouisLuxuriousWheels_v1(034b97419349), AddNet Weight A 2: 1, AddNet Weight B 2: 1 129 | 130 | ## [SFW] Side ponytail + Multicolored hair 131 | 132 |
133 |

Demo 案例

134 | 135 |
136 | 137 | 138 | ### Prompts 提示标签 139 | 140 | ``` 141 | side ponytail, ((nahida \(genshin impact\))), (((Kpop idol))),aegyo sal,multicolored hair,((hair between eyes)),white hair,green hair,green eyes,((pointy ears)),((flat chest)),(photorealistic:1.4),(masterpiece:1.4),(best quality:1.4),1girl, solo,ultra high res,((detailed facial features)),upper body, small hands, 142 | ``` 143 | 144 | ### Negative prompts 反向提示标签 145 | 146 | ``` 147 | paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, (outdoor:1.6), manboobs, backlight,(ugly:1.331), (duplicate:1.331), (morbid:1.21), (mutilated:1.21), (tranny:1.331), mutated hands, (poorly drawn hands:1.331), blurry, (bad anatomy:1.21), (bad proportions:1.331), extra limbs, (disfigured:1.331), (more than 2 nipples:1.331), (missing arms:1.331), (extra legs:1.331), (fused fingers:1.61051), (too many fingers:1.61051), (unclear eyes:1.331), bad hands, missing fingers, extra digit, (futa:1.1), bad body, NG_DeepNegative_V1_75T,pubic hair, glans,(nipples:1.41),nsfw, 148 | ``` 149 | 150 | ### Others 其他 151 | 152 | - Steps: 25, 153 | - Sampler: DPM++ 2M Karras, 154 | - CFG scale: 7, 155 | - Model: chilloutmix, 156 | - AddNet Enabled: True, 157 | - AddNet Module 1: LoRA, AddNet Model 1: koreanDollLikeness_v10(e2e472c06607), AddNet Weight A 1: 0.5, AddNet Weight B 1: 0.5, 158 | - AddNet Module 2: LoRA, AddNet Model 2: stLouisLuxuriousWheels_v1(034b97419349), AddNet Weight A 2: 1, AddNet Weight B 2: 1 159 | 160 | ## [SFW] Sleeveless white 161 | 162 |
163 |

Demo 案例

164 | 165 |
166 | 167 | ### Prompts 提示标签 168 | 169 | ``` 170 | best quality, ultra high res, (photorealistic:1.4), 1girl, sleeveless white , cute, (Kpop idol), (aegyo sal:1), (platinum blonde hair:1), ((puffy eyes)), looking at viewer, full body, facing front, smiling 171 | ``` 172 | 173 | ### Negative prompts 反向提示标签 174 | 175 | ``` 176 | EasyNegative, paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans,extra fingers,fewer fingers, 177 | ``` 178 | 179 | ### Others 其他 180 | 181 | - Steps: 25, 182 | - Sampler: DPM++ 2M Karras, 183 | - CFG scale: 7, 184 | - Model: chilloutmix, 185 | - AddNet Enabled: True, 186 | - AddNet Module 1: LoRA, AddNet Model 1: koreanDollLikeness_v10(e2e472c06607), AddNet Weight A 1: 0.5, AddNet Weight B 1: 0.5, 187 | - AddNet Module 2: LoRA, AddNet Model 2: stLouisLuxuriousWheels_v1(034b97419349), AddNet Weight A 2: 1, AddNet Weight B 2: 1 188 | 189 | ## [SFW] Redgown 190 | 191 |
192 |

Demo 案例

193 | 194 |
195 | 196 | 197 | ### Prompts 提示标签 198 | 199 | ``` 200 | best quality, blonde hair, long hair, ultra high res, (photorealistic:1.4), 1girl, redgown, redhat,(upper body), (Kpop idol), (aegyo sal:1), (platinum blonde hair:1), ((puffy eyes)), looking at viewer, facing front, wet skin, rain, night, 201 | ``` 202 | 203 | ### Negative prompts 反向提示标签 204 | 205 | ``` 206 | EasyNegative, paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans, extra fingers, fewer fingers,watermark, 207 | ``` 208 | 209 | ### Others 其他 210 | 211 | - Steps: 25, 212 | - Sampler: DPM++ 2M Karras, 213 | - CFG scale: 7, 214 | - Model: chilloutmix, 215 | - AddNet Enabled: True, 216 | - AddNet Module 1: LoRA, AddNet Model 1: koreanDollLikeness_v10(e2e472c06607), AddNet Weight A 1: 0.5, AddNet Weight B 1: 0.5, 217 | - AddNet Module 2: LoRA, AddNet Model 2: **girlsFrontlineOts14_v30(c2824b876e6b)**, AddNet Weight A 2: 1, AddNet Weight B 2: 1 218 | 219 | ## [NSFW] Seductive pose 220 | 221 |
222 |

Demo 案例

223 | 224 |
225 | 226 | ### Prompts 提示标签 227 | 228 | ``` 229 | best quality, ultra high res, (photorealistic:1.4), 1girl, white camisole, (Kpop idol), (aegyo sal:1), (seductive pose),(busty), (cleavage), (curvy), large breasts,(blonde grey long hair:1.3), (((looking at viewer))), ((full body)), ((puffy eyes)), ((closeup)) 230 | ``` 231 | 232 | ### Negative prompts 反向提示标签 233 | 234 | ``` 235 | paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot 236 | ``` 237 | 238 | ### Others 其他 239 | 240 | - Steps: 25, 241 | - Sampler: DPM++ 2M Karras, 242 | - CFG scale: 7, 243 | - Model: chilloutmix, 244 | - AddNet Enabled: True, 245 | - AddNet Module 1: LoRA, AddNet Model 1: koreanDollLikeness_v10(e2e472c06607), AddNet Weight A 1: 0.5, AddNet Weight B 1: 0.5, 246 | 247 | ## [SFW] White sports bra + Outdoors 248 | 249 |
250 |

Demo 案例

251 | 252 |
253 | 254 | ### Prompts 提示标签 255 | 256 | ``` 257 | best quality, ultra high res, (photorealistic:1.4), 1girl, loose and oversized black jacket, white sports bra, (green yoga pants:1), (Kpop idol), (aegyo sal:1), (light brown short ponytail:1.2), ((puffy eyes)), looking at viewer, smiling, cute, full body, streets, outdoors 258 | ``` 259 | 260 | ### Negative prompts 反向提示标签 261 | 262 | ``` 263 | paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans, nsfw 264 | ``` 265 | 266 | ### Others 其他 267 | 268 | - Steps: 25, 269 | - Sampler: DPM++ 2M Karras, 270 | - CFG scale: 7, 271 | - Model: chilloutmix, 272 | - AddNet Enabled: True, 273 | - AddNet Module 1: LoRA, AddNet Model 1: koreanDollLikeness_v10(e2e472c06607), AddNet Weight A 1: 0.65, AddNet Weight B 1: 0.5, 274 | 275 | ## [SFW] Blue long & elbow dress 276 | 277 |
278 |

Demo 案例

279 | 280 |
281 | 282 | ### Prompts 提示标签 283 | 284 | ``` 285 | best quality, ultra high res, (photorealistic:1.4), 1girl, solo focus, ((blue long dress)), elbow dress, black thighhighs, frills, ribbons, studio background, (Kpop idol), (aegyo sal:1), (platinum blonde hair:1), ((puffy eyes)), looking at viewer, facing front, smiling, laughing 286 | ``` 287 | 288 | ### Negative prompts 反向提示标签 289 | 290 | ``` 291 | paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans, nsfw, nipples 292 | ``` 293 | 294 | ### Others 其他 295 | 296 | - Steps: 25, 297 | - Sampler: DPM++ 2M Karras, 298 | - CFG scale: 7, 299 | - Model: chilloutmix, 300 | - AddNet Enabled: True, 301 | - AddNet Module 1: LoRA, AddNet Model 1: koreanDollLikeness_v10(e2e472c06607), AddNet Weight A 1: 0.65, AddNet Weight B 1: 0.5, 302 | 303 | ## [SFW] Platinum blonde hair + Black skirt 304 | 305 |
306 |

Demo 案例

307 | 308 |
309 | 310 | ### Prompts 提示标签 311 | 312 | ``` 313 | best quality, ultra high res, (photorealistic:1.4), 1woman, sleeveless white button shirt, black skirt, black choker, cute, (Kpop idol), (aegyo sal:1), (platinum blonde hair:1), ((puffy eyes)), looking at viewer, full body, facing front, masterpiece, best quality, 314 | ``` 315 | 316 | ### Negative prompts 反向提示标签 317 | 318 | ``` 319 | paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans, nsfw, nipples, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry 320 | ``` 321 | 322 | ### Others 其他 323 | 324 | - Steps: 25, 325 | - Sampler: DPM++ 2M Karras, 326 | - CFG scale: 7, 327 | - Model: chilloutmix, 328 | - AddNet Enabled: True, 329 | - AddNet Module 1: LoRA, AddNet Model 1: koreanDollLikeness_v10(e2e472c06607), AddNet Weight A 1: 0.5, AddNet Weight B 1: 0.5, 330 | - AddNet Module 2: LoRA, AddNet Model 2: stLouisLuxuriousWheels_v1(034b97419349), AddNet Weight A 2: 1, AddNet Weight B 2: 1 331 | 332 | ## [SFW] Black tight suit + Cyberpunk city 333 | 334 |
335 |

Demo 案例

336 | 337 |
338 | 339 | 340 | ### Prompts 提示标签 341 | 342 | ``` 343 | (8k, RAW photo, best quality, masterpiece:1.2), (realistic, photo-realistic:1.37),(Kpop idol), (aegyo sal:1),cute,professional lighting, photon mapping, radiosity, physically-based rendering, cosplay, lucy \(cyberpunk\),bob cut,mechanical parts,grey eyes, black tight suit,cyberpunk city, black pants,night,neon lights,sexy,porn,smoke, looking at viewer, 344 | ``` 345 | 346 | ### Negative prompts 反向提示标签 347 | 348 | ``` 349 | paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans, nsfw, nipples, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry 350 | ``` 351 | 352 | ### Others 其他 353 | 354 | - Steps: 25, 355 | - Sampler: DPM++ 2M Karras, 356 | - CFG scale: 7, 357 | - Model: chilloutmix, 358 | - AddNet Enabled: True, 359 | - AddNet Module 1: LoRA, AddNet Model 1: koreanDollLikeness_v10(e2e472c06607), AddNet Weight A 1: 0.5, AddNet Weight B 1: 0.5, 360 | - AddNet Module 2: LoRA, AddNet Model 2: stLouisLuxuriousWheels_v1(034b97419349), AddNet Weight A 2: 1, AddNet Weight B 2: 1 361 | 362 | ## [SFW] Basic Tiara 363 | 364 |
365 |

Demo 案例

366 | 367 |
368 | 369 | ### Prompts 提示标签 370 | 371 | ``` 372 | best quality, highres,(RAW photo:1.2), (photorealistic:1.4),(masterpiece:1.4),1girl, long hair, black hair, ,medium breasts, (Kpop idol), (smile:1.1), half body, intricate chocker, ((Tiara on head)), natural lighting 373 | ``` 374 | 375 | ### Negative prompts 反向提示标签 376 | 377 | ``` 378 | paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot,distorted finger, amputation, missing hands and fingers, extra hand and finger, obese, doubled face, double hands, (ugly face:1.2), out of frame, (crooked finger:1.3),extra legs, mutated hands, fused fingers, (too many fingers),NG_DeepNegative_V1_75T, nsfw 379 | ``` 380 | 381 | ### Others 其他 382 | 383 | - Steps: 28, 384 | - Sampler: DPM++ SDE Karras, 385 | - CFG scale: 7, 386 | - Model: chilloutmix 387 | -------------------------------------------------------------------------------- /stable_diffusion_1_5_webui.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "attachments": {}, 5 | "cell_type": "markdown", 6 | "metadata": { 7 | "id": "SKi-oMBwhutR" 8 | }, 9 | "source": [ 10 | "# AUTOMATIC1111 Stable Diffusion WebUI 1.5 + ChilloutMix Checkpoint\n", 11 | "\n", 12 | "More info: https://github.com/wibus-wee/stable_diffusion_chilloutmix_ipynb\n", 13 | "\n", 14 | "> Created by [@wibus-wee](https://github.com/wibus-wee)\n", 15 | ">\n", 16 | "> Reference: [camenduru/{appPrefix}-colab](https://github.com/camenduru/{appPrefix}-colab)" 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": null, 22 | "metadata": {}, 23 | "outputs": [], 24 | "source": [ 25 | "from IPython.display import display\n", 26 | "import ipywidgets as widgets\n", 27 | "import requests\n", 28 | "\n", 29 | "#@title 选择模型 { display-mode: \"form\" }\n", 30 | "endpoint = 'https://civitai.com/api/v1/models'\n", 31 | "#@markdown 选择模型( Others 需要后面填入模型ID 或 URL)\n", 32 | "checkpointName = 'Chilloutmix' #@param [\"Chilloutmix\", \"Sunshinemix\", \"grapefruit_hentai\", \"others\"]\n", 33 | "#@markdown 其他模型 (填入模型ID, 如 6424, 多个模型用英文逗号分隔)\n", 34 | "checkpointID = '' #@param {type:\"string\"}\n", 35 | "#@markdown 其他模型 (填入模型URL, 多个模型用英文逗号分隔)\n", 36 | "checkpointURL = '' #@param {type:\"string\"}\n", 37 | "\n", 38 | "#@markdown ---\n", 39 | "\n", 40 | "#@markdown ## **LoRAs**\n", 41 | "\n", 42 | "#@markdown Korean Doll Likeness `v1.0`\n", 43 | "koreanDollLikenessv10 = True #@param {type:\"boolean\"}\n", 44 | "#@markdown Korean Doll Likeness `v1.5`\n", 45 | "koreanDollLikenessv15 = True #@param {type:\"boolean\"}\n", 46 | "#@markdown Korean Doll Likeness `v2.0`\n", 47 | "koreanDollLikenessv20 = True #@param {type:\"boolean\"}\n", 48 | "#@markdown St. Louis (Luxurious Wheels) (Azur Lane)\n", 49 | "stLouis = True #@param {type:\"boolean\"}\n", 50 | "#@markdown Girls' Frontline-OTs-14\"lightning\"\n", 51 | "girlsFrontlineOTs14Lightning = True #@param {type:\"boolean\"}\n", 52 | "#@markdown Yae Miko | Realistic Genshin (Mixed)\n", 53 | "yaeMikoRealisticGenshinMixed = True #@param {type:\"boolean\"}\n", 54 | "#@markdown Fashion Girl\n", 55 | "fashionGirl = True #@param {type:\"boolean\"}\n", 56 | "#@markdown Cute Girl mix4\n", 57 | "cuteGirlMix4 = True #@param {type:\"boolean\"}\n", 58 | "#@markdown More LoRA? (Enter the URL of the lora file, use comma to separate multiple URLs)\n", 59 | "moreLoRA = \"\" #@param {type:\"string\"}\n", 60 | "\n", 61 | "#@markdown ---\n", 62 | "\n", 63 | "#@markdown ## **Textual Inversion**\n", 64 | "\n", 65 | "#@markdown Ulzzang-6500 (Korean doll aesthetic)\n", 66 | "ulzzang6500 = True #@param {type:\"boolean\"}\n", 67 | "#@markdown Pure Eros Face\n", 68 | "pureErosFace = True #@param {type:\"boolean\"}\n", 69 | "\n", 70 | "\n", 71 | "defaultCheckpoint = {\n", 72 | " 'Chilloutmix': '6424',\n", 73 | " 'Sunshinemix': '9291',\n", 74 | " 'grapefruit_hentai': '2583'\n", 75 | "}\n", 76 | "\n", 77 | "loraDownloadIDs = {\n", 78 | " 'koreanDollLikenessv10': 'https://huggingface.co/Kanbara/doll-likeness-series/resolve/main/koreanDollLikeness_v10.safetensors',\n", 79 | " 'koreanDollLikenessv15': 'https://huggingface.co/Kanbara/doll-likeness-series/resolve/main/koreanDollLikeness_v15.safetensors',\n", 80 | " 'koreanDollLikenessv20': 'https://huggingface.co/Kanbara/doll-likeness-series/resolve/main/koreanDollLikeness_v20.safetensors',\n", 81 | " 'stLouis': 6669,\n", 82 | " 'girlsFrontlineOTs14Lightning': 6525,\n", 83 | " 'yaeMikoRealisticGenshinMixed': 8484,\n", 84 | " # 'chilloutMixss': 10850,\n", 85 | " 'fashionGirl': {\n", 86 | " \"id\": 8217,\n", 87 | " \"version\": \"v4.5\"\n", 88 | " },\n", 89 | " 'cuteGirlMix4': 14171,\n", 90 | "}\n", 91 | "\n", 92 | "textualInversionDownloadIDs = {\n", 93 | " 'ulzzang6500': 8109,\n", 94 | " 'pureErosFace': 4514,\n", 95 | "}\n", 96 | "\n", 97 | "downloadIds = []\n", 98 | "\n", 99 | "if checkpointID != '':\n", 100 | " downloadIds = checkpointID.split(',')\n", 101 | "if checkpointName != 'others':\n", 102 | " downloadIds.append(defaultCheckpoint[checkpointName])\n", 103 | "\n", 104 | "globalDropdowns = []\n", 105 | "globalVerions = []\n", 106 | "globalNames = []\n", 107 | "globalTexts = []\n", 108 | "checkpoints = []\n", 109 | "downloadLinks = []\n", 110 | "customLoras = []\n", 111 | "loraDownloadLinks = []\n", 112 | "\n", 113 | "def text_on_submit(change):\n", 114 | " checkpoints[checkpoints.index(change['old'])] = change['new']\n", 115 | "\n", 116 | "if checkpointURL != '':\n", 117 | " _downloadLinks = checkpointURL.split(',')\n", 118 | " for _downloadLink in _downloadLinks:\n", 119 | " checkpoints.append(_downloadLink.split('/')[-1])\n", 120 | " downloadLinks.append(_downloadLink)\n", 121 | " text = widgets.Text(value=_downloadLink.split('/')[-1], description=_downloadLink.split('/')[-1], disabled=False)\n", 122 | " text.observe(text_on_submit, names='value')\n", 123 | " form = widgets.VBox([text])\n", 124 | " display(form)\n", 125 | "if moreLoRA != '':\n", 126 | " _downloadLinks = moreLoRA.split(',')\n", 127 | " for _downloadLink in _downloadLinks:\n", 128 | " customLoras.append(_downloadLink)\n", 129 | " loraDownloadLinks.append(_downloadLink)\n", 130 | " text = widgets.Text(value=_downloadLink.split('/')[-1], description=_downloadLink.split('/')[-1], disabled=False)\n", 131 | " text.observe(text_on_submit, names='value')\n", 132 | " form = widgets.VBox([text])\n", 133 | " display(form)\n", 134 | "\n", 135 | "\n", 136 | "def showVerionOptions(downloadId):\n", 137 | " res = requests.get(endpoint + '/' + downloadId).json()\n", 138 | " globalNames.append(res['name'])\n", 139 | " versions = res['modelVersions']\n", 140 | " globalVerions.append(versions)\n", 141 | " options = []\n", 142 | " for version in versions:\n", 143 | " options.append(version['files'][0]['name'])\n", 144 | " dropdown = widgets.Dropdown(options=options, description=res['name'])\n", 145 | " globalDropdowns.append(dropdown)\n", 146 | " form = widgets.VBox([dropdown])\n", 147 | " display(form)\n", 148 | "\n", 149 | "for downloadId in downloadIds:\n", 150 | " showVerionOptions(downloadId)\n", 151 | "\n", 152 | "def on_button_clicked(b):\n", 153 | " downloadLink = None\n", 154 | " for dropdown in globalDropdowns:\n", 155 | " checkpoint = dropdown.value\n", 156 | " versions = globalVerions[globalDropdowns.index(dropdown)]\n", 157 | " for version in versions:\n", 158 | " if version['files'][0]['name'] == checkpoint:\n", 159 | " downloadLink = version['files'][0]['downloadUrl']\n", 160 | " break\n", 161 | " if downloadLink is None:\n", 162 | " print('Error: downloadLink not assigned')\n", 163 | " return\n", 164 | " checkpoints.append(checkpoint)\n", 165 | " downloadLinks.append(downloadLink)\n", 166 | "\n", 167 | " print(\"已选择模型: \" + str(checkpoints) + \" <===> \" + str(downloadLinks))\n", 168 | " print(\"自定义 LoRA (仅显示填入 moreLoRA 中的 LoRA): \" + str(customLoras) + \" <===> \" + str(loraDownloadLinks))\n", 169 | " %store checkpoints\n", 170 | " %store downloadLinks\n", 171 | "\n", 172 | "\n", 173 | "button = widgets.Button(description='Use it!')\n", 174 | "button.on_click(on_button_clicked)\n", 175 | "display(button)" 176 | ] 177 | }, 178 | { 179 | "cell_type": "code", 180 | "execution_count": null, 181 | "metadata": {}, 182 | "outputs": [], 183 | "source": [ 184 | "#@title 2. 检查 GPU & 检查环境\n", 185 | "\n", 186 | "#@markdown 此步骤将检查你的 GPU 是否支持 xformers,同时会检查是否为 Paperspace 平台(仅针对 M4000 GPU 做了判断,因此付费 GPU 可能在此处将会出现逻辑判断错误的情况,你可能需要自行勾选为 Paperspace 平台)。\n", 187 | "\n", 188 | "import os, subprocess\n", 189 | "paperspace_m4000 = False\n", 190 | "#@markdown 是否为 Paperspace 平台\n", 191 | "isPaperspace = False #@param {type:\"boolean\"}\n", 192 | "appPrefix = 'stable' + '-' + 'diffusion' + '-' + 'webui' # app prefix\n", 193 | "sdModelPrefix = 'Stable' + '-' + 'diffusion'\n", 194 | "ecosystemUIPrefix = \"sd-webui\" # 因为我们发现它是匹配的 xxx/sd@webui-xxx 的,我们只需要把 sd@webui 抽出来,在后面的代码中用变量替换即可\n", 195 | "\n", 196 | "# 备用方案\n", 197 | "# banPrefixs = [\n", 198 | "# { \n", 199 | "# 'name': \"bing-su--tunnels\",\n", 200 | "# 'prefix': \"Bing-su\" + '/' + \"{ecosystemUIPrefix}-tunnels\"\n", 201 | "# }\n", 202 | "# ]\n", 203 | "\n", 204 | "# def getBanPrefix(name):\n", 205 | "# for banPrefix in banPrefixs:\n", 206 | "# if banPrefix['name'] == name:\n", 207 | "# return banPrefix['prefix']\n", 208 | "# return None\n", 209 | "\n", 210 | "try:\n", 211 | " subprocess.run(['nvidia-smi', '--query-gpu=name', '--format=csv,noheader'], stdout=subprocess.PIPE)\n", 212 | " if 'M4000' in subprocess.run(['nvidia-smi', '--query-gpu=name', '--format=csv,noheader'], stdout=subprocess.PIPE).stdout.decode('utf-8'):\n", 213 | " print(\"WARNING: 你正在使用的是 Quadro M4000 GPU,它将无法使用 xformers。\")\n", 214 | " paperspace_m4000 = True\n", 215 | " isPaperspace = True\n", 216 | " else:\n", 217 | " print(\"你正在使用的是合适的 GPU - \" + subprocess.run(['nvidia-smi', '--query-gpu=name', '--format=csv,noheader'], stdout=subprocess.PIPE).stdout.decode('utf-8') + \"。\")\n", 218 | " print(\"平台: Paperspace\" if isPaperspace else \"使用平台: Colab\")\n", 219 | "except:\n", 220 | " print(\"似乎没有 GPU 可用。请检查你的运行时类型。\")\n", 221 | " exit()\n", 222 | "\n", 223 | "rootDir = isPaperspace and '/tmp' or '/content'\n", 224 | "diffusionWebUIInstalled = os.path.exists(rootDir + '/' + appPrefix)\n", 225 | "%store rootDir\n", 226 | "%store paperspace_m4000 \n", 227 | "%store isPaperspace\n", 228 | "%store diffusionWebUIInstalled" 229 | ] 230 | }, 231 | { 232 | "cell_type": "code", 233 | "execution_count": null, 234 | "metadata": { 235 | "id": "SaAJk33ppFw1" 236 | }, 237 | "outputs": [], 238 | "source": [ 239 | "import requests\n", 240 | "#@title 3. 第一次使用 - 安装依赖并启动\n", 241 | "\n", 242 | "#@markdown ## **Extensions**\n", 243 | "#@markdown > 你可以在安装时选择安装扩展,扩展将会在启动时自动安装。如果你想要在启动后再安装扩展,你可能需要重启运行时。\n", 244 | "\n", 245 | "#@markdown 安装 xformer 包 (仅在 Paperspace M4000 GPU 平台上运行时需要选择,若选择则会构建 xformers 包).\n", 246 | "xformersInstall = True #@param {type:\"boolean\"}\n", 247 | "#@markdown 安装 ControlNet 扩展\n", 248 | "controlNetExtension = True #@param {type:\"boolean\"}\n", 249 | "#@markdown 安装 OpenPose Editor 扩展\n", 250 | "openPoseExtension = True #@param {type:\"boolean\"}\n", 251 | "#@markdown 安装 Civitai Browser 扩展\n", 252 | "civitaiBrowserExtension = True #@param {type:\"boolean\"}\n", 253 | "#@markdown 安装 HuggingFace 扩展\n", 254 | "huggingFaceExtension = True #@param {type:\"boolean\"}\n", 255 | "#@markdown 安装 Images Browser 扩展\n", 256 | "imagesBrowserExtension = True #@param {type:\"boolean\"}\n", 257 | "#@markdown 安装 Additional Networks 扩展\n", 258 | "additionalNetworksExtension = True #@param {type:\"boolean\"}\n", 259 | "#@markdown 安装 Deforum 扩展\n", 260 | "deforumExtension = False #@param {type:\"boolean\"}\n", 261 | "#@markdown 安装 Kohya sd-scripts 扩展 ( 启动后再安装需要重启 )\n", 262 | "kohyaExtension = False #@param {type:\"boolean\"}\n", 263 | "#@markdown 安装 DreamBooth 扩展\n", 264 | "dreamBoothExtension = False #@param {type:\"boolean\"}\n", 265 | "\n", 266 | "#@markdown ---\n", 267 | "\n", 268 | "#@markdown ## **Others**\n", 269 | "\n", 270 | "#@markdown Styles CSV File URL\n", 271 | "stylesCSVFileURL = \"\" #@param {type:\"string\"}\n", 272 | "#@markdown Use [Cloudflared](https://github.com/cloudflare/cloudflared) instead of Gradio share\n", 273 | "useCloudflared = False #@param {type:\"boolean\"}\n", 274 | "\n", 275 | "#@markdown ---\n", 276 | "\n", 277 | "#@markdown ## **Startup Options**\n", 278 | "\n", 279 | "#@markdown API Support\n", 280 | "apiSupport = True #@param {type:\"boolean\"}\n", 281 | "#@markdown Cors Allow Origins\n", 282 | "corsAllowOrigins = \"*\" #@param {type:\"string\"}\n", 283 | "\n", 284 | "def getLatestModelDownloadURL(id):\n", 285 | " try:\n", 286 | " if type(id) == int:\n", 287 | " res = requests.get(endpoint + '/' + str(id)).json()\n", 288 | " latest = res['modelVersions'][0]\n", 289 | " downloadLink = latest['files'][0]['downloadUrl']\n", 290 | " name = latest['files'][0]['name']\n", 291 | " return {\n", 292 | " 'url': downloadLink,\n", 293 | " 'name': name\n", 294 | " }\n", 295 | " else:\n", 296 | " return {\n", 297 | " 'url': id,\n", 298 | " 'name': id.split('/')[-1]\n", 299 | " }\n", 300 | " except:\n", 301 | " print(\"Lora model \" + str(id) + \" not found. Skip.\")\n", 302 | " return None\n", 303 | "\n", 304 | "def getSpecificModelDownloadURL(id, version):\n", 305 | " try:\n", 306 | " if type(id) == int:\n", 307 | " res = requests.get(endpoint + '/' + str(id)).json()\n", 308 | " for modelVersion in res['modelVersions']:\n", 309 | " if modelVersion['name'] == version:\n", 310 | " # if modelVersion[\"baseModel\"] != \"SD 1.5\":\n", 311 | " # print(\"Lora model \" + str(id) + \" is not SD 1.5, may not work. Skip.\")\n", 312 | " # return None\n", 313 | " downloadLink = modelVersion['files'][0]['downloadUrl']\n", 314 | " name = modelVersion['files'][0]['name']\n", 315 | " return {\n", 316 | " 'url': downloadLink,\n", 317 | " 'name': name\n", 318 | " }\n", 319 | " else:\n", 320 | " return {\n", 321 | " 'url': id,\n", 322 | " 'name': id.split('/')[-1]\n", 323 | " }\n", 324 | " except:\n", 325 | " print(\"Lora model \" + str(id) + \" version \" + version + \" not found. Skip.\")\n", 326 | " return None\n", 327 | "\n", 328 | "def getLoraDownloadURLs():\n", 329 | " downloadURLs = []\n", 330 | " for key in loraDownloadIDs:\n", 331 | " if not eval(key): # skip if not selected\n", 332 | " continue\n", 333 | " if type(loraDownloadIDs[key]) is int:\n", 334 | " downloadURLs.append(getLatestModelDownloadURL(loraDownloadIDs[key]))\n", 335 | " elif type(loraDownloadIDs[key]) is dict: # {'id': 123, 'version': 'v1.0'}\n", 336 | " downloadURLs.append(getSpecificModelDownloadURL(loraDownloadIDs[key]['id'], loraDownloadIDs[key]['version']))\n", 337 | " elif type(loraDownloadIDs[key]) is str: # url\n", 338 | " downloadURLs.append({ 'url': loraDownloadIDs[key], 'name': loraDownloadIDs[key].split('/')[-1] })\n", 339 | " downloadURLs = [x for x in downloadURLs if x is not None] # remove None\n", 340 | " for custom in customLoras:\n", 341 | " downloadURLs.append({ 'url': loraDownloadLinks[customLoras.index(custom)], 'name': custom })\n", 342 | " return downloadURLs\n", 343 | "\n", 344 | "def getTextualInversionDownloadURLs():\n", 345 | " downloadURLs = []\n", 346 | " for key in textualInversionDownloadIDs:\n", 347 | " if not eval(key): # skip if not selected\n", 348 | " continue\n", 349 | " if type(textualInversionDownloadIDs[key]) is int:\n", 350 | " downloadURLs.append(getLatestModelDownloadURL(textualInversionDownloadIDs[key]))\n", 351 | " elif type(textualInversionDownloadIDs[key]) is dict: # {'id': 123, 'version': 'v1.0'}\n", 352 | " downloadURLs.append(getSpecificModelDownloadURL(textualInversionDownloadIDs[key]['id'], textualInversionDownloadIDs[key]['version']))\n", 353 | " elif type(textualInversionDownloadIDs[key]) is str: # url\n", 354 | " downloadURLs.append({ 'url': textualInversionDownloadIDs[key], 'name': textualInversionDownloadIDs[key].split('/')[-1] })\n", 355 | " downloadURLs = [x for x in downloadURLs if x is not None]\n", 356 | " return downloadURLs\n", 357 | " \n", 358 | "\n", 359 | "loraDownloadURLs = getLoraDownloadURLs()\n", 360 | "textualInversionDownloadURLs = getTextualInversionDownloadURLs()\n", 361 | "\n", 362 | "\n", 363 | "%store -r paperspace_m4000 \n", 364 | "%store -r isPaperspace\n", 365 | "%store -r rootDir \n", 366 | "%store -r checkpoints\n", 367 | "%store -r downloadLinks\n", 368 | "%store -r diffusionWebUIInstalled\n", 369 | "\n", 370 | "import subprocess\n", 371 | "\n", 372 | "!apt-get -y install -qq aria2\n", 373 | "ariaInstalled = False\n", 374 | "\n", 375 | "try:\n", 376 | " subprocess.run(['aria2c', '--version'], stdout=subprocess.PIPE)\n", 377 | " ariaInstalled = True\n", 378 | "except:\n", 379 | " pass\n", 380 | "\n", 381 | "!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", 382 | "!pip install -q xformers==0.0.19 triton==2.0.0 -U\n", 383 | "\n", 384 | "!git clone https://github.com/AUTOMATIC1111/{appPrefix} {rootDir}/{appPrefix}\n", 385 | "!git clone https://huggingface.co/embed/negative {rootDir}/{appPrefix}/embeddings/negative\n", 386 | "!git clone https://huggingface.co/embed/lora {rootDir}/{appPrefix}/models/Lora/positive\n", 387 | "!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/embed/upscale/resolve/main/4x-UltraSharp.pth -d {rootDir}/{appPrefix}/models/ESRGAN -o 4x-UltraSharp.pth\n", 388 | "!git clone https://github.com/Bing-su/{ecosystemUIPrefix}-tunnels {rootDir}/{appPrefix}/extensions/{ecosystemUIPrefix}-tunnels\n", 389 | "!git clone https://github.com/thomasasfk/{ecosystemUIPrefix}-aspect-ratio-helper {rootDir}/{appPrefix}/extensions/{ecosystemUIPrefix}-aspect-ratio-helper\n", 390 | "!wget https://raw.githubusercontent.com/camenduru/{appPrefix}-scripts/main/run_n_times.py -O {rootDir}/{appPrefix}/scripts/run_n_times.py\n", 391 | "if deforumExtension:\n", 392 | " !git clone https://github.com/deforum-art/deforum-for-automatic1111-webui {rootDir}/{appPrefix}/extensions/deforum-for-automatic1111-webui\n", 393 | "if imagesBrowserExtension:\n", 394 | " !git clone https://github.com/AlUlkesh/{appPrefix}-images-browser {rootDir}/{appPrefix}/extensions/{appPrefix}-images-browser\n", 395 | "if huggingFaceExtension:\n", 396 | " !git clone https://github.com/camenduru/{appPrefix}-huggingface {rootDir}/{appPrefix}/extensions/{appPrefix}-huggingface\n", 397 | "if civitaiBrowserExtension:\n", 398 | " !git clone https://github.com/Vetchems/sd-civitai-browser {rootDir}/{appPrefix}/extensions/sd-civitai-browser\n", 399 | "if openPoseExtension:\n", 400 | " !git clone https://github.com/fkunn1326/openpose-editor {rootDir}/{appPrefix}/extensions/openpose-editor\n", 401 | "if controlNetExtension:\n", 402 | " !git clone https://github.com/Mikubill/{ecosystemUIPrefix}-controlnet {rootDir}/{appPrefix}/extensions/{ecosystemUIPrefix}-controlnet\n", 403 | "if additionalNetworksExtension:\n", 404 | " !git clone https://github.com/kohya-ss/{ecosystemUIPrefix}-additional-networks {rootDir}/{appPrefix}/extensions/{ecosystemUIPrefix}-additional-networks\n", 405 | "if kohyaExtension:\n", 406 | " !git clone https://github.com/ddpn08/kohya-sd-scripts-webui.git {rootDir}/{appPrefix}/extensions/kohya-sd-scripts-webui\n", 407 | "if dreamBoothExtension:\n", 408 | " !git clone https://github.com/d8ahazard/sd_dreambooth_extension {rootDir}/{appPrefix}/extensions/sd_dreambooth_extension\n", 409 | "\n", 410 | "if isPaperspace:\n", 411 | " %cd /{appPrefix}\n", 412 | "else:\n", 413 | " %cd {rootDir}/{appPrefix}\n", 414 | "\n", 415 | "\n", 416 | "webuiControlNetModels = [\n", 417 | " \"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_canny-fp16.safetensors\",\n", 418 | " \"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_depth-fp16.safetensors\",\n", 419 | " \"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_hed-fp16.safetensors\",\n", 420 | " \"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_mlsd-fp16.safetensors\",\n", 421 | " \"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_normal-fp16.safetensors\",\n", 422 | " \"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_openpose-fp16.safetensors\",\n", 423 | " \"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_scribble-fp16.safetensors\",\n", 424 | " \"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_seg-fp16.safetensors\",\n", 425 | "]\n", 426 | "annotatorLink = [\n", 427 | " \"https://huggingface.co/ckpt/ControlNet/resolve/main/hand_pose_model.pth\",\n", 428 | " \"https://huggingface.co/ckpt/ControlNet/resolve/main/body_pose_model.pth\",\n", 429 | " \"https://huggingface.co/ckpt/ControlNet/resolve/main/dpt_hybrid-midas-501f0c75.pt\",\n", 430 | " \"https://huggingface.co/ckpt/ControlNet/resolve/main/mlsd_large_512_fp32.pth\",\n", 431 | " \"https://huggingface.co/ckpt/ControlNet/resolve/main/mlsd_tiny_512_fp32.pth\",\n", 432 | " \"https://huggingface.co/ckpt/ControlNet/resolve/main/network-bsds500.pth\",\n", 433 | " \"https://huggingface.co/ckpt/ControlNet/resolve/main/upernet_global_small.pth\",\n", 434 | "]\n", 435 | "\n", 436 | "def ariaDownload(downloadLink, checkpoint, path):\n", 437 | " if (type(downloadLink) == list and type(checkpoint) == list):\n", 438 | " for i in downloadLink:\n", 439 | " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {i} -d {path} -o {checkpoint[downloadLink.index(i)]}\n", 440 | " else:\n", 441 | " !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M {downloadLink} -d {path} -o {checkpoint}\n", 442 | "def wgetDownload(downloadLink, checkpoint, path):\n", 443 | " if (type(downloadLink) == list and type(checkpoint) == list):\n", 444 | " for i in downloadLink:\n", 445 | " !wget -c {i} -P {path} -O {checkpoint[downloadLink.index(i)]}\n", 446 | " else:\n", 447 | " !wget -c {downloadLink} -P {path} -O {checkpoint}\n", 448 | "def autoDetectDownload(downloadLink, checkpoint, path):\n", 449 | " if ariaInstalled:\n", 450 | " ariaDownload(downloadLink, checkpoint, path)\n", 451 | " else:\n", 452 | " wgetDownload(downloadLink, checkpoint, path)\n", 453 | "\n", 454 | "autoDetectDownload(downloadLinks, checkpoints, rootDir + \"/\" + appPrefix + \"/models/\" + sdModelPrefix)\n", 455 | "if controlNetExtension:\n", 456 | " for model in webuiControlNetModels:\n", 457 | " autoDetectDownload(model, model.split('/')[-1], rootDir + \"/\" + appPrefix + \"/extensions/\" + ecosystemUIPrefix + \"-controlnet/models\")\n", 458 | " for model in annotatorLink:\n", 459 | " autoDetectDownload(model, model.split('/')[-1], rootDir + \"/\" + appPrefix + \"/extensions/\" + ecosystemUIPrefix + \"-controlnet/annotator\")\n", 460 | "for model in loraDownloadURLs:\n", 461 | " autoDetectDownload(model[\"url\"], model[\"name\"], rootDir + \"/\" + appPrefix + \"/models/Lora\")\n", 462 | "for model in textualInversionDownloadURLs:\n", 463 | " autoDetectDownload(model[\"url\"], model[\"name\"], rootDir + \"/\" + appPrefix + \"/embeddings\")\n", 464 | "if stylesCSVFileURL:\n", 465 | " # autoDetectDownload(stylesCSVFileURL, \"styles.csv\", rootDir + \"/{appPrefix}\")\n", 466 | " autoDetectDownload(stylesCSVFileURL, \"styles.csv\", rootDir + \"/\" + appPrefix)\n", 467 | "\n", 468 | "if additionalNetworksExtension:\n", 469 | " !ln -s {rootDir}/{appPrefix}/models/Lora {rootDir}/{appPrefix}/extensions/{ecosystemUIPrefix}-additional-networks/models/lora\n", 470 | "\n", 471 | "\n", 472 | "diffusionWebUIInstalled = True\n", 473 | "%store diffusionWebUIInstalled\n", 474 | "\n", 475 | "%cd {rootDir}/{appPrefix}\n", 476 | "!sed -i -e 's/\\\"sd_model_checkpoint\\\"\\,/\\\"sd_model_checkpoint\\,sd_vae\\,CLIP_stop_at_last_layers\\\"\\,/g' {rootDir}/{appPrefix}/modules/shared.py\n", 477 | "\n", 478 | "if dreamBoothExtension:\n", 479 | " !export REQS_FILE=\"./extensions/sd_dreambooth_extension/requirements.txt\"\n", 480 | "\n", 481 | "backgroundProcess = ''\n", 482 | "\n", 483 | "if useCloudflared:\n", 484 | " backgroundProcess = 'cloudflared tunnel --url 127.0.0.1:7860'\n", 485 | " # !cloudflared tunnel --url 127.0.0.1:7860\n", 486 | "if backgroundProcess:\n", 487 | " backgroundProcess = backgroundProcess + ' &'\n", 488 | "\n", 489 | "if useCloudflared:\n", 490 | " !echo \"Installing cloudflared\"\n", 491 | " !curl -Lo /usr/bin/cloudflared https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cloudflared\n", 492 | "\n", 493 | "!{backgroundProcess} python launch.py --enable-insecure-extension-access {'' if paperspace_m4000 and not xformersInstall else '--xformers'} {'--api --cors-allow-origins \"*\" --listen' if corsAllowOrigins else ''} {'--share' if not backgroundProcess else ''} --gradio-queue --multiple" 494 | ] 495 | }, 496 | { 497 | "cell_type": "code", 498 | "execution_count": null, 499 | "metadata": { 500 | "id": "UilfY37zpOoK" 501 | }, 502 | "outputs": [], 503 | "source": [ 504 | "\n", 505 | "#@title 4. 重启 - 重新启动 Stable Diffusion WebUI\n", 506 | "\n", 507 | "%store -r paperspace_m4000 \n", 508 | "%store -r rootDir \n", 509 | "%store -r diffusionWebUIInstalled\n", 510 | "\n", 511 | "if not diffusionWebUIInstalled:\n", 512 | " print(\"请先运行安装 Stable Diffusion WebUI 的单元格。\")\n", 513 | " exit()\n", 514 | "\n", 515 | "%cd {rootDir}/{appPrefix}\n", 516 | "!sed -i -e 's/\\\"sd_model_checkpoint\\\"\\,/\\\"sd_model_checkpoint\\,sd_vae\\,CLIP_stop_at_last_layers\\\"\\,/g' {rootDir}/{appPrefix}/modules/shared.py\n", 517 | "\n", 518 | "!{backgroundProcess} python launch.py --enable-insecure-extension-access {'' if paperspace_m4000 and not xformersInstall else '--xformers'} {'--api --cors-allow-origins \"*\" --listen' if corsAllowOrigins else ''} {'--share' if not backgroundProcess else ''} --gradio-queue --multiple" 519 | ] 520 | }, 521 | { 522 | "cell_type": "code", 523 | "execution_count": null, 524 | "metadata": {}, 525 | "outputs": [], 526 | "source": [ 527 | "#@title 5. 导出 - 导出生成的图片\n", 528 | "%store -r rootDir \n", 529 | "\n", 530 | "from pathlib import Path\n", 531 | "import os, subprocess\n", 532 | "\n", 533 | "export_storage_dir = Path(rootDir, 'export')\n", 534 | "export_storage_dir.mkdir(exist_ok=True)\n", 535 | "\n", 536 | "!if [ $(dpkg-query -W -f='${Status}' p7zip-full 2>/dev/null | grep -c \"ok installed\") = 0 ]; then sudo apt update && sudo apt install -y p7zip-full; fi # install 7z if it isn't already installed\n", 537 | "from datetime import datetime\n", 538 | "datetime_str = datetime.now().strftime('%m-%d-%Y_%H-%M-%S')\n", 539 | "%cd \"{export_storage_dir}\"\n", 540 | "!mkdir -p \"{datetime_str}/log\"\n", 541 | "!cd \"{rootDir}/{appPrefix}/log\" && mv * \"{export_storage_dir / datetime_str / 'log'}\"\n", 542 | "!cd \"{rootDir}/{appPrefix}/outputs\" && mv * \"{export_storage_dir / datetime_str}\"\n", 543 | "s = subprocess.run(f'find \"{Path(export_storage_dir, datetime_str)}\" -type d -name .ipynb_checkpoints -exec rm -rv {{}} +', shell=True)\n", 544 | "!7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on \"{datetime_str}.7z\" \"{export_storage_dir / datetime_str}\"" 545 | ] 546 | } 547 | ], 548 | "metadata": { 549 | "accelerator": "GPU", 550 | "colab": { 551 | "collapsed_sections": [ 552 | "SEQh1nJopSDr" 553 | ], 554 | "private_outputs": true, 555 | "provenance": [] 556 | }, 557 | "gpuClass": "standard", 558 | "kernelspec": { 559 | "display_name": "Python 3", 560 | "language": "python", 561 | "name": "python3" 562 | }, 563 | "language_info": { 564 | "codemirror_mode": { 565 | "name": "ipython", 566 | "version": 3 567 | }, 568 | "file_extension": ".py", 569 | "mimetype": "text/x-python", 570 | "name": "python", 571 | "nbconvert_exporter": "python", 572 | "pygments_lexer": "ipython3", 573 | "version": "3.11.1" 574 | }, 575 | "vscode": { 576 | "interpreter": { 577 | "hash": "5c7b89af1651d0b8571dde13640ecdccf7d5a6204171d6ab33e7c296e100e08a" 578 | } 579 | } 580 | }, 581 | "nbformat": 4, 582 | "nbformat_minor": 0 583 | } 584 | -------------------------------------------------------------------------------- /xformers_build.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "attachments": {}, 5 | "cell_type": "markdown", 6 | "metadata": {}, 7 | "source": [ 8 | "# XFormers Builder\n", 9 | "\n", 10 | "If you are using Google Colab, there are many precompiled wheels for you to choose from. If you are using something else or want to build from source, you can use this notebook to build the library.\n", 11 | "\n", 12 | "More info: https://github.com/wibus-wee/stable_diffusion_chilloutmix_ipynb\n", 13 | "\n", 14 | "> Created by [@wibus-wee](https://github.com/wibus-wee)\n", 15 | ">\n", 16 | "> Reference: [camenduru/stable-diffusion-webui-colab](https://github.com/camenduru/stable-diffusion-webui-colab)" 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": null, 22 | "metadata": {}, 23 | "outputs": [], 24 | "source": [ 25 | "#@title Install dependencies & Build xformers\n", 26 | "\n", 27 | "#@markdown Operating directory\n", 28 | "#@markdown If you are running this notebook on Google Colab, you can input \"/content\" as the working directory. Or you are running this notebook on Paperspace, you can input \"/tmp\" as the working directory.\n", 29 | "working_dir = \"/tmp\" #@param {type:\"string\"}\n", 30 | "\n", 31 | "#@markdown Output\n", 32 | "#@markdown If you are running this notebook on Paperspace, you can input \"/notebook\" as the output directory.\n", 33 | "output = \"/notebook/xformers\" #@param {type:\"string\"}\n", 34 | "\n", 35 | "%cd {working_dir}\n", 36 | "!pip install --upgrade setuptools\n", 37 | "!pip install ninja\n", 38 | "!git clone https://github.com/facebookresearch/xformers.git\n", 39 | "%cd xformers\n", 40 | "!git checkout 6f3c20f223c0f051e4b2dc744cc7591591ee04c4\n", 41 | "!git submodule update --init --recursive\n", 42 | "!pip install -r requirements.txt\n", 43 | "\n", 44 | "!python setup.py sdist bdist_wheel --universal\n", 45 | "!mv dist {output}" 46 | ] 47 | } 48 | ], 49 | "metadata": { 50 | "language_info": { 51 | "name": "python" 52 | }, 53 | "orig_nbformat": 4 54 | }, 55 | "nbformat": 4, 56 | "nbformat_minor": 2 57 | } 58 | --------------------------------------------------------------------------------