{ "cells": [ { "cell_type": "markdown", "id": "2a86fcac-7907-4ab9-8287-d21b241e1b89", "metadata": {}, "source": [ "RUN THIS CODE BELOW (Only in the first run)" ] }, { "cell_type": "code", "execution_count": null, "id": "7ad40e45-9797-4188-be16-2e6c4d218ddc", "metadata": { "tags": [] }, "outputs": [], "source": [ "#Install all essentials for stable diffusion\n", "!conda install -c conda-forge libglib -y & conda update -n base conda -y\n", "!git clone --depth 1 https://github.com/dreamscapeai/stable-diffusion-webui\n", "%cd ~/stable-diffusion-webui\n", "!git pull\n", "\n", "!mkdir /home/studio-lab-user/stable-diffusion-webui/outputs\n", "\n", "%cd /home/studio-lab-user/stable-diffusion-webui/embeddings\n", "!git clone --depth 1 https://github.com/dreamscapeai/negativekit\n", "\n", "%cd /home/studio-lab-user/stable-diffusion-webui/extensions\n", "!git clone --depth 1 https://github.com/etherealxx/batchlinks-webui\n", "!git clone --depth 1 https://github.com/zanllp/sd-webui-infinite-image-browsing\n", "!git clone --depth 1 https://github.com/dreamscapeai/CN-v11400\n", "!git clone --depth 1 https://github.com/dreamscapeai/adetailer\n", "!git clone --depth 1 https://github.com/dreamscapeai/ultimatesdupscale\n", "!git clone --depth 1 https://github.com/dreamscapeai/tagcomplete\n", "\n", "#load your checkpoints\n", "!curl -Lo \"/home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion/epicphotogasm.safetensors\" \"https://civitai.com/api/download/models/145885\"" ] }, { "cell_type": "markdown", "id": "9c02e956-5769-4be9-96e9-fea479706e91", "metadata": {}, "source": [ "BOOT LAUNCHER " ] }, { "cell_type": "code", "execution_count": null, "id": "9ea3ea45-056c-4863-a06a-3f7422bf7e20", "metadata": { "tags": [] }, "outputs": [], "source": [ "#Don't forget to paste your NGROK token here\n", "%cd ~/stable-diffusion-webui\n", "!python launch.py --listen --xformers --enable-insecure-extension-access --theme dark --gradio-queue --ngrok PASTE_YOUR_TOKEN_HERE" ] }, { "cell_type": "markdown", "id": "0a4e8d6c-8060-486f-a37f-b1c1a42433fd", "metadata": {}, "source": [] }, { "cell_type": "code", "execution_count": null, "id": "fdeece9b-7e0a-4c93-aec2-6d96b95cdc84", "metadata": { "tags": [] }, "outputs": [], "source": [ "#download and compress all outputs\n", "import zipfile\n", "import os\n", "\n", "def create_zip_archive(source_dir, output_path):\n", " with zipfile.ZipFile(output_path, 'w', zipfile.ZIP_DEFLATED) as zipf:\n", " for root, dirs, files in os.walk(source_dir):\n", " for file in files:\n", " file_path = os.path.join(root, file)\n", " zipf.write(file_path, os.path.relpath(file_path, source_dir))\n", "\n", "# Specify the source directory and output path\n", "source_dir = '/home/studio-lab-user/stable-diffusion-webui/outputs'\n", "output_path = '/home/studio-lab-user/outputs.zip'\n", "\n", "# Create the ZIP archive\n", "create_zip_archive(source_dir, output_path)" ] }, { "cell_type": "code", "execution_count": 15, "id": "439692fe-f99d-4703-aa6d-27a8bcc8a775", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Filesystem Size Used Avail Use% Mounted on\n", "/dev/nvme1n1 25G 11G 15G 42% /home/studio-lab-user\n" ] } ], "source": [ "#Check the storage available (if storage full, can cause problem)\n", "!df -h | grep -E 'Avail|home'" ] }, { "cell_type": "code", "execution_count": 14, "id": "b8a56c3a-f0af-4c87-bf83-c99942a3a3b0", "metadata": {}, "outputs": [], "source": [ "#delete and empty the OUTPUT folder\n", "!rm -rf /home/studio-lab-user/stable-diffusion-webui/outputs/*" ] }, { "cell_type": "code", "execution_count": null, "id": "8ac13a1e-906a-4da8-b98b-0e300ab5b8b4", "metadata": {}, "outputs": [], "source": [ "#delete and empty the MODELS folder\n", "!rm -rf /home/studio-lab-user/stable-diffusion-webui/models/Stable-diffusion/*" ] }, { "cell_type": "markdown", "id": "0c18d664-3e44-45a6-a25c-8402e590e5b7", "metadata": {}, "source": [] }, { "cell_type": "markdown", "id": "1c518ead-677f-42f0-a67f-1d30327fec10", "metadata": {}, "source": [] }, { "cell_type": "markdown", "id": "1d0a3313-0c65-44ef-b89e-459fa779e84b", "metadata": {}, "source": [ "START CLEAN EVERYTHING ONLY IF YOU HAVE ERROR" ] }, { "cell_type": "code", "execution_count": null, "id": "5ad6a08b-34a4-4a73-b618-38715a895bd2", "metadata": { "tags": [] }, "outputs": [], "source": [ "#Check the storage available (if storage full, can cause problem)\n", "!df -h | grep -E 'Avail|home'" ] }, { "cell_type": "code", "execution_count": null, "id": "aaea3473-1ac6-40d8-98c2-a29386ca147e", "metadata": { "tags": [] }, "outputs": [], "source": [ "#List all folders and sizes\n", "!du -h --max-depth=1 /home/studio-lab-user" ] }, { "cell_type": "code", "execution_count": null, "id": "ab02c781-46ea-4f07-8c4b-f329069d903b", "metadata": {}, "outputs": [], "source": [ "#clean remove all env, cache and file\n", "!rm -r /home/studio-lab-user/.cache\n", "!rm -r /home/studio-lab-user/.conda\n", "!conda remove -n \"env_name\" --all\n", "!rm -rf /home/studio-lab-user/*" ] }, { "cell_type": "markdown", "id": "baaf8967-78f3-4b63-9427-313bffa67a93", "metadata": {}, "source": [] }, { "cell_type": "markdown", "id": "bf5499c3-18fb-4325-8c37-5298751e4f97", "metadata": {}, "source": [ "BELOW ONLY FOR TROUBLESHOOTING" ] }, { "cell_type": "code", "execution_count": null, "id": "38f3b678-ce14-47c8-b8ca-5b2295fc628c", "metadata": {}, "outputs": [], "source": [ "%cd ~/stable-diffusion-webui\n", "!pip install -r requirements.txt" ] }, { "cell_type": "code", "execution_count": null, "id": "6c7131fd-9ce7-4c3c-861c-a3acc252c086", "metadata": { "tags": [] }, "outputs": [], "source": [ "%cd ~/stable-diffusion-webui\n", "!python launch.py --listen --xformers --enable-insecure-extension-access --theme dark --ngrok auth" ] }, { "cell_type": "code", "execution_count": null, "id": "5bb61644-e972-402e-aff6-c6445ff99965", "metadata": { "tags": [] }, "outputs": [], "source": [ "import torch\n", "torch.cuda.get_device_name(0)" ] }, { "cell_type": "code", "execution_count": null, "id": "d6a8c055-4668-40cd-aa41-8bc6474c9ff0", "metadata": { "tags": [] }, "outputs": [], "source": [ "import torch\n", "print(torch.version.cuda)" ] }, { "cell_type": "code", "execution_count": null, "id": "6b3f9867-000e-43f4-9b04-ae5c0d9166bd", "metadata": { "tags": [] }, "outputs": [], "source": [ "!pip uninstall torchvision -y" ] }, { "cell_type": "code", "execution_count": null, "id": "2d990595-7f34-4946-9a21-197306222434", "metadata": { "tags": [] }, "outputs": [], "source": [ "!pip install torchvision==0.10.0" ] }, { "cell_type": "code", "execution_count": null, "id": "5b85fa10-c03f-4942-a227-02d1cbe90f4a", "metadata": { "tags": [] }, "outputs": [], "source": [ "!pip install torch==1.10.0" ] }, { "cell_type": "code", "execution_count": null, "id": "abc7178a-c5b7-4722-8e9e-728308d83d70", "metadata": { "tags": [] }, "outputs": [], "source": [ "!pip install xformers==0.0.20 tomesd==0.1.3 pytorch-lightning==1.9.4 accelerate==0.21.0" ] }, { "cell_type": "code", "execution_count": null, "id": "577b9843-0e8c-4dd8-aa02-8eaf8c51f1d8", "metadata": { "tags": [] }, "outputs": [], "source": [ "!conda install -c conda-forge libglib -y" ] }, { "cell_type": "code", "execution_count": null, "id": "f24321a3-700a-47e9-8995-0893dd2f834f", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "default:Python", "language": "python", "name": "conda-env-default-py" }, "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.10.13" } }, "nbformat": 4, "nbformat_minor": 5 }