\n",
"\n",
@@ -49,7 +32,7 @@
"\n",
"## Installation instructions for:\n",
"\n",
- "- **[Windows](https://sygil-dev.github.io/sygil-webui/docs/1.windows-installation.html)** \n",
+ "- **[Windows](https://sygil-dev.github.io/sygil-webui/docs/1.windows-installation.html)**\n",
"- **[Linux](https://sygil-dev.github.io/sygil-webui/docs/2.linux-installation.html)**\n",
"\n",
"### Want to ask a question or request a feature?\n",
@@ -172,7 +155,7 @@
"\n",
"If you want to use GFPGAN to improve generated faces, you need to install it separately.\n",
"Download [GFPGANv1.4.pth](https://github.com/TencentARC/GFPGAN/releases/download/v1.3.4/GFPGANv1.4.pth) and put it\n",
- "into the `/sygil-webui/models/gfpgan` directory. \n",
+ "into the `/sygil-webui/models/gfpgan` directory.\n",
"\n",
"### RealESRGAN\n",
"\n",
@@ -182,7 +165,7 @@
"There is also a separate tab for using RealESRGAN on any picture.\n",
"\n",
"Download [RealESRGAN_x4plus.pth](https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth) and [RealESRGAN_x4plus_anime_6B.pth](https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth).\n",
- "Put them into the `sygil-webui/models/realesrgan` directory. \n",
+ "Put them into the `sygil-webui/models/realesrgan` directory.\n",
"\n",
"\n",
"\n",
@@ -219,8 +202,8 @@
"\n",
"[Stable Diffusion](#stable-diffusion-v1) is a latent text-to-image diffusion\n",
"model.\n",
- "Thanks to a generous compute donation from [Stability AI](https://stability.ai/) and support from [LAION](https://laion.ai/), we were able to train a Latent Diffusion Model on 512x512 images from a subset of the [LAION-5B](https://laion.ai/blog/laion-5b/) database. \n",
- "Similar to Google's [Imagen](https://arxiv.org/abs/2205.11487), \n",
+ "Thanks to a generous compute donation from [Stability AI](https://stability.ai/) and support from [LAION](https://laion.ai/), we were able to train a Latent Diffusion Model on 512x512 images from a subset of the [LAION-5B](https://laion.ai/blog/laion-5b/) database.\n",
+ "Similar to Google's [Imagen](https://arxiv.org/abs/2205.11487),\n",
"this model uses a frozen CLIP ViT-L/14 text encoder to condition the model on text prompts.\n",
"With its 860M UNet and 123M text encoder, the model is relatively lightweight and runs on a GPU with at least 10GB VRAM.\n",
"See [this section](#stable-diffusion-v1) below and the [model card](https://huggingface.co/CompVis/stable-diffusion).\n",
@@ -229,26 +212,26 @@
"\n",
"Stable Diffusion v1 refers to a specific configuration of the model\n",
"architecture that uses a downsampling-factor 8 autoencoder with an 860M UNet\n",
- "and CLIP ViT-L/14 text encoder for the diffusion model. The model was pretrained on 256x256 images and \n",
+ "and CLIP ViT-L/14 text encoder for the diffusion model. The model was pretrained on 256x256 images and\n",
"then finetuned on 512x512 images.\n",
"\n",
"*Note: Stable Diffusion v1 is a general text-to-image diffusion model and therefore mirrors biases and (mis-)conceptions that are present\n",
- "in its training data. \n",
+ "in its training data.\n",
"Details on the training procedure and data, as well as the intended use of the model can be found in the corresponding [model card](https://huggingface.co/CompVis/stable-diffusion).\n",
"\n",
"## Comments\n",
"\n",
"- Our codebase for the diffusion models builds heavily on [OpenAI's ADM codebase](https://github.com/openai/guided-diffusion)\n",
- " and [https://github.com/lucidrains/denoising-diffusion-pytorch](https://github.com/lucidrains/denoising-diffusion-pytorch). \n",
+ " and [https://github.com/lucidrains/denoising-diffusion-pytorch](https://github.com/lucidrains/denoising-diffusion-pytorch).\n",
" Thanks for open-sourcing!\n",
"\n",
- "- The implementation of the transformer encoder is from [x-transformers](https://github.com/lucidrains/x-transformers) by [lucidrains](https://github.com/lucidrains?tab=repositories). \n",
+ "- The implementation of the transformer encoder is from [x-transformers](https://github.com/lucidrains/x-transformers) by [lucidrains](https://github.com/lucidrains?tab=repositories).\n",
"\n",
"## BibTeX\n",
"\n",
"```\n",
"@misc{rombach2021highresolution,\n",
- " title={High-Resolution Image Synthesis with Latent Diffusion Models}, \n",
+ " title={High-Resolution Image Synthesis with Latent Diffusion Models},\n",
" author={Robin Rombach and Andreas Blattmann and Dominik Lorenz and Patrick Esser and Björn Ommer},\n",
" year={2021},\n",
" eprint={2112.10752},\n",
@@ -257,24 +240,26 @@
"}\n",
"\n",
"```"
- ],
- "metadata": {
- "id": "z4kQYMPQn4d-"
- }
+ ]
},
{
"cell_type": "markdown",
+ "metadata": {
+ "id": "iegma7yteERV"
+ },
"source": [
"# Config options for Colab instance\n",
"> Before running, make sure GPU backend is enabled. (Unless you plan on generating with Stable Horde)\n",
">> Runtime -> Change runtime type -> Hardware Accelerator -> GPU (Make sure to save)"
- ],
- "metadata": {
- "id": "iegma7yteERV"
- }
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "OXn96M9deVtF"
+ },
+ "outputs": [],
"source": [
"#@title { display-mode: \"form\" }\n",
"#@markdown WebUI repo (and branch)\n",
@@ -306,40 +291,40 @@
"\n",
"#@markdown Save models to Google Drive for faster loading in future (Be warned! Make sure you have enough space!)\n",
"SAVE_MODELS = False #@param {type:\"boolean\"}"
- ],
- "metadata": {
- "id": "OXn96M9deVtF"
- },
- "execution_count": null,
- "outputs": []
+ ]
},
{
"cell_type": "markdown",
+ "metadata": {
+ "id": "IZjJSr-WPNxB"
+ },
"source": [
"# Setup\n",
"\n",
">Runtime will crash when installing conda. This is normal as we are forcing a restart of the runtime from code.\n",
"\n",
">Just hit \"Run All\" again. 😑"
- ],
- "metadata": {
- "id": "IZjJSr-WPNxB"
- }
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
"metadata": {
"id": "eq0-E5mjSpmP"
},
+ "outputs": [],
"source": [
"#@title Make sure we have access to GPU backend\n",
"!nvidia-smi -L"
- ],
- "execution_count": null,
- "outputs": []
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "cDu33xkdJ5mD"
+ },
+ "outputs": [],
"source": [
"#@title Install miniConda (mamba)\n",
"!pip install condacolab\n",
@@ -349,15 +334,15 @@
"import condacolab\n",
"condacolab.check()\n",
"# The runtime will crash here!!! Don't panic! We planned for this remember?"
- ],
- "metadata": {
- "id": "cDu33xkdJ5mD"
- },
- "execution_count": null,
- "outputs": []
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "pZHGf03Vp305"
+ },
+ "outputs": [],
"source": [
"#@title Clone webUI repo and download font\n",
"import os\n",
@@ -367,41 +352,41 @@
"%cd {PATH_TO_REPO}\n",
"!git checkout {repo_branch}\n",
"!git pull"
- ],
- "metadata": {
- "id": "pZHGf03Vp305"
- },
- "execution_count": null,
- "outputs": []
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "dmN2igp5Yk3z"
+ },
+ "outputs": [],
"source": [
"#@title Install dependencies\n",
"!mamba install cudatoolkit=11.3 git numpy=1.22.3 pip=20.3 python=3.8.5 pytorch=1.11.0 scikit-image=0.19.2 torchvision=0.12.0 -y\n",
"!python --version\n",
"!pip install -r requirements.txt"
- ],
- "metadata": {
- "id": "dmN2igp5Yk3z"
- },
- "execution_count": null,
- "outputs": []
+ ]
},
{
"cell_type": "code",
- "source": [
- "#@title Install localtunnel to openGoogle's ports\n",
- "!npm install localtunnel"
- ],
+ "execution_count": null,
"metadata": {
"id": "Nxaxfgo_F8Am"
},
- "execution_count": null,
- "outputs": []
+ "outputs": [],
+ "source": [
+ "#@title Install localtunnel to openGoogle's ports\n",
+ "!npm install localtunnel"
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "pcSWo9Zkzbsf"
+ },
+ "outputs": [],
"source": [
"#@title Mount Google Drive (if selected)\n",
"if mount_google_drive:\n",
@@ -414,15 +399,15 @@
" OUTPUT_PATH = os.path.join('/content/drive/MyDrive', repo_name.split('/')[1], 'outputs')\n",
" os.makedirs(OUTPUT_PATH, exist_ok=True)\n",
" os.symlink(OUTPUT_PATH, os.path.join(PATH_TO_REPO, 'outputs'), target_is_directory=True)\n"
- ],
- "metadata": {
- "id": "pcSWo9Zkzbsf"
- },
- "execution_count": null,
- "outputs": []
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "vMdmh81J70yA"
+ },
+ "outputs": [],
"source": [
"#@title Pre-fetch models\n",
"%cd {PATH_TO_REPO}\n",
@@ -502,7 +487,7 @@
" file_url = file_info[file]['download_link']\n",
" if 'save_location' in file_info[file]:\n",
" file_path = file_info[file]['save_location']\n",
- " else: \n",
+ " else:\n",
" file_path = models[model]['save_location']\n",
" download_file(file_name, file_path, file_url)\n",
"\n",
@@ -529,15 +514,13 @@
" os.symlink(CONFIG_DIR, config_location)\n",
"\n",
"\n"
- ],
- "metadata": {
- "id": "vMdmh81J70yA"
- },
- "execution_count": null,
- "outputs": []
+ ]
},
{
"cell_type": "markdown",
+ "metadata": {
+ "id": "pjIjiCuJysJI"
+ },
"source": [
"# Launch the web ui server\n",
"### (optional) JS to prevent idle timeout:\n",
@@ -549,37 +532,102 @@
"}\n",
"setInterval(ClickConnect,60000)\n",
"```"
- ],
- "metadata": {
- "id": "pjIjiCuJysJI"
- }
+ ]
},
{
"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "-WknaU7uu_q6"
+ },
+ "outputs": [],
"source": [
"#@title Press play on the music player to keep the tab alive (Uses only 13MB of data)\n",
"%%html\n",
"Press play on the music player to keep the tab alive, then start your generation below (Uses only 13MB of data) \n",
"