File size: 4,097 Bytes
6154420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
{
 "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. [Support](https://ko-fi.com/thelastben)"
   ]
  },
  {
   "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, 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": "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)\n",
    "!python /notebooks/sd/stable-diffusion-webui/webui.py --ckpt $model $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
}