{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Dependencies" ] }, { "cell_type": "code", "execution_count": null, "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", "with open('/dev/null', 'w') as devnull:import requests, os, time, importlib;open('/workspace/runpod_server.py', 'wb').write(requests.get('https://huggingface.co/datasets/TheLastBen/RNPD/raw/main/Scripts/mainrunpodA1111.py').content);os.chdir('/workspace');time.sleep(2);import mainrunpodA1111;importlib.reload(mainrunpodA1111);from mainrunpodA1111 import *;Deps(force_reinstall)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Install/Update AUTOMATIC1111 repo" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Huggingface_token_optional=\"\"\n", "\n", "# Restore your backed-up SD folder by entering your huggingface token, leave it empty to start fresh or continue with the existing sd folder (if any).\n", "\n", "#--------------------\n", "repo(Huggingface_token_optional)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Model Download/Load" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Original_Model_Version = \"SDXL\"\n", "\n", "# Choices are \"SDXL\", \"v1.5\", \"v2-512\", \"v2-768\"\n", "\n", "#-------------- Or\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", "\n", "#--------------------\n", "model=mdl(Original_Model_Version, Path_to_MODEL, MODEL_LINK)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# LoRA Download" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Download/update ControlNet extension and its models.\n", "\n", "ControlNet_v1_Model = \"all\"\n", "\n", "# Choices are : none; all; 1: Canny; 2: Depth; 3: Lineart; 4: MLSD; 5: Normal; 6: OpenPose; 7: Scribble; 8: Seg; 9: ip2p; 10:Shuffle; 11: Inpaint; 12: Softedge; 13: Lineart_Anime; 14: Tile; 15: T2iadapter_Models\n", "\n", "ControlNet_XL_Model = \"all\"\n", "\n", "# Choices are : none; all; 1: Canny; 2: Depth; 3: Sketch; 4: OpenPose; 5: Recolor\n", "\n", "#--------------------\n", "CNet(ControlNet_v1_Model, ControlNet_XL_Model)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Start Stable-Diffusion" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "User = \"\"\n", "\n", "Password= \"\"\n", "\n", "# Add credentials to your Gradio interface (optional).\n", "\n", "#-----------------\n", "configf=sd(User, Password, model) if 'model' in locals() else sd(User, Password, \"\");import gradio;gradio.close_all()\n", "!python /workspace/sd/stable-diffusion-webui/webui.py $configf" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Backup SD folder" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# This will backup your sd folder -without the models- to your huggingface account, so you can restore it whenever you start an instance.\n", "\n", "Huggingface_Write_token=\"\"\n", "\n", "# Must be a WRITE token, get yours here : https://huggingface.co/settings/tokens\n", "\n", "#--------------------\n", "save(Huggingface_Write_token)" ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 2 }