{ "cells": [ { "cell_type": "markdown", "id": "6441563f-5e6b-4987-abe3-2a1b8c25a789", "metadata": {}, "source": [ "## A1111 Paperspace Notebook From https://github.com/TheLastBen/fast-stable-diffusion, if you encounter any issues, feel free to discuss them." ] }, { "cell_type": "markdown", "id": "840f2f6a-41d1-4938-a846-d51f76682b76", "metadata": {}, "source": [ "# Dependencies" ] }, { "cell_type": "code", "execution_count": null, "id": "62e22de7-f054-45a7-b7e3-b63b9a0188a1", "metadata": {}, "outputs": [], "source": [ "# Install the dependencies\n", "\n", "force_reinstall= False\n", "\n", "# Set to true only if you want to install the dependencies again.\n", "\n", "\n", "#--------------------\n", "with open('/dev/null', 'w') as devnull:import requests, os, time, importlib;open('/notebooks/mainpaperspaceA1111.py', 'wb').write(requests.get('https://huggingface.co/datasets/TheLastBen/PPS/raw/main/Scripts/mainpaperspaceA1111.py').content);os.chdir('/notebooks');time.sleep(3);import mainpaperspaceA1111;importlib.reload(mainpaperspaceA1111);from mainpaperspaceA1111 import *;Deps(force_reinstall)" ] }, { "cell_type": "markdown", "id": "e21f3583-2d0f-4218-9da2-303f9e202820", "metadata": { "tags": [] }, "source": [ "# Install/Update AUTOMATIC1111 repo" ] }, { "cell_type": "code", "execution_count": null, "id": "ed6cebed-8a4f-4a35-b5c3-36126be008b9", "metadata": {}, "outputs": [], "source": [ "# Don't skip this cell to make sure the repo is up to date and functioning correctly\n", "\n", "#--------------------\n", "repo()" ] }, { "cell_type": "markdown", "id": "ab0521c7-8c68-4ea2-915a-bc3f4b67f6e7", "metadata": {}, "source": [ "# Model Download/Load" ] }, { "cell_type": "code", "execution_count": null, "id": "a6f367e0-df08-41fd-91b5-e2afbcbd42e4", "metadata": {}, "outputs": [], "source": [ "Original_Model_Version = \"v1.5\"\n", "\n", "# Choices are \"v1.5\", \"v2-512\", \"v2-768\"\n", "\n", "\n", "Path_to_MODEL = \"\"\n", "\n", "# Insert the full path of your trained model or to a folder containing multiple models.\n", "\n", "\n", "MODEL_LINK = \"\"\n", "\n", "# A direct link to a Model or a shared gdrive link.\n", "\n", "safetensors= False\n", "\n", "# Set to True if the model from the link is in safetensors format.\n", "\n", "Temporary_Storage = True\n", "\n", "# Download the model to a temporary storage, bigger capacity but will be removed at session shutdown.\n", "\n", "\n", "#--------------------\n", "model=mdl(Original_Model_Version, Path_to_MODEL, MODEL_LINK, safetensors, Temporary_Storage)" ] }, { "cell_type": "markdown", "id": "2f9228f8-3d2b-4964-a848-f75ae1618d9f", "metadata": {}, "source": [ "# ControlNet" ] }, { "cell_type": "code", "execution_count": null, "id": "90c5d7c8-d0dc-43dc-9232-1351e8f80b5e", "metadata": {}, "outputs": [], "source": [ "# Download/update ControlNet extension and its models.\n", "\n", "ControlNet_Model = \"all\"\n", "\n", "# Choices are : none; all; 1: Canny; 2: Depth; 3: HED; 4: MLSD; 5: Normal; 6: OpenPose; 7: Scribble; 8: Seg; 9: T2iadapter_Models\n", "\n", "ControlNet_v2_Model = \"none\"\n", "\n", "# Choices are : none; all; 1: Canny; 2: Depth; 3: HED; 4: OpenPose; 5: Scribble\n", "\n", "#--------------------\n", "CN(ControlNet_Model, ControlNet_v2_Model)" ] }, { "cell_type": "markdown", "id": "e0baf0c4-a410-432f-891b-975c7250c77d", "metadata": {}, "source": [ "# Start Stable-Diffusion" ] }, { "cell_type": "code", "execution_count": null, "id": "0121ea1d-1aa0-4961-b916-c5dbb900e05f", "metadata": {}, "outputs": [], "source": [ "User = \"\"\n", "\n", "Password= \"\"\n", "\n", "# Add credentials to your Gradio interface (optional).\n", "\n", "Use_localtunnel = False\n", "\n", "# If you have trouble using Gradio server, use this one.\n", "\n", "\n", "#-----------------\n", "configf=sd(User, Password, Use_localtunnel, model)\n", "!python /notebooks/sd/stable-diffusion-webui/webui.py $configf" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.13" } }, "nbformat": 4, "nbformat_minor": 5 }