{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "VBDPqhYnyBL1" }, "source": [ "Check GPU" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "woQCdVO8x-Kt" }, "outputs": [], "source": [ "!nvidia-smi" ] }, { "cell_type": "markdown", "metadata": { "id": "OHCtG9MT0jLq" }, "source": [ "Clone webui repository and download the model." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "ZzRNMT42Gw_p" }, "outputs": [], "source": [ "%cd /content\n", "!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui\n", "%cd stable-diffusion-webui\n", "!git pull\n", "!mkdir -p /content/stable-diffusion-webui/models/Stable-diffusion\n", "%cd /content/stable-diffusion-webui/models/Stable-diffusion/\n", "!apt install -y -qq aria2\n", "!aria2c --summary-interval=10 -x 16 -s 16 --allow-overwrite=true -Z https://huggingface.co/JosephusCheung/ACertainModel/resolve/main/ACertainModel-half.ckpt\n", "%cd /content\n", "!aria2c --summary-interval=10 -x 16 -s 16 --allow-overwrite=true -Z https://huggingface.co/JosephusCheung/ACertainModel/resolve/main/animevae.pt" ] }, { "cell_type": "markdown", "metadata": { "id": "xt8lbdmC04ox" }, "source": [ "Launch web ui. You will get a link to nnn.gradio.app, follow it.\n", "\n", "Commandline arguments are:\n", " - `--share` - create online gradio.app link\n", " - `--gradio-debug` - print outputs to console\n", " - `--gradio-auth me:qwerty` - add authentication to gradio: username me, password qwerty" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "R-xAdMA5wxXd", "outputId": "c3f7f6fe-7769-452d-9433-3023c156a244" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Interrupted with signal 2 in \n" ] } ], "source": [ "%cd /content/stable-diffusion-webui\n", "\n", "# hacks to load model in colab\n", "!sed -i 's/map_location=\"cpu\"/map_location=\"cuda\"/g' /content/stable-diffusion-webui/modules/sd_models.py\n", "\n", "!pip install -U -qq pip\n", "!pip install -qq -r requirements.txt\n", "!pip install -qq -U --pre triton\n", "!pip install -qq pytorch_lightning==1.7.7\n", "!pip install https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.15/xformers-0.0.15.dev0+189828c.d20221207-cp38-cp38-linux_x86_64.whl\n", "!echo \"\" > /tmp/requirements_empty.txt\n", "!COMMANDLINE_ARGS=\"--xformers --share --gradio-debug --vae-path /content/animevae.pt\" REQS_FILE=\"/tmp/requirements_empty.txt\" python launch.py" ] }, { "cell_type": "markdown", "metadata": { "id": "T3957x2AY7iP" }, "source": [ "commands for ***after*** you have gotten done with a session\n", "============================================================================" ] }, { "cell_type": "markdown", "metadata": { "id": "aCtJffM2ZE06" }, "source": [ "Zip images for downloading on local drive (click the folder icon on the left, the one below {x})" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "TmRqNyiAZCHu" }, "outputs": [], "source": [ "!zip -r /content/stable-diffusion-webui /content/stable-diffusion-webui/outputs " ] }, { "cell_type": "markdown", "metadata": { "id": "tcslU-S2ZNr9" }, "source": [ "Save images to Google Drive **Warning: this will cause google to scan your drive, so if you intend to use this and worry about that kind of stuff, probablly just set this up on a clean account that's just for this colab**" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "-N0lnu-TZOTW" }, "outputs": [], "source": [ "from google.colab import drive # type: ignore\n", "\n", "try:\n", " drive_path = \"/content/drive\"\n", " drive.mount(drive_path,force_remount=False)\n", "except:\n", " print(\"...error mounting drive or with drive path variables\")\n", "\n", "!cp -r \"/content/stable-diffusion-webui/outputs\" \"/content/drive/MyDrive\"" ] } ], "metadata": { "accelerator": "GPU", "colab": { "provenance": [] }, "gpuClass": "premium", "kernelspec": { "display_name": "Python 3", "name": "python3" }, "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 0 }