File size: 4,861 Bytes
6154420
 
 
 
 
 
 
2ae6599
6154420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b9bb020
6154420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2ae6599
6154420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2ae6599
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ea0117f
 
 
 
 
 
 
2ae6599
 
ea0117f
2ae6599
 
6154420
 
 
 
 
2ae6599
6154420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2ae6599
 
6154420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2ae6599
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
{
 "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
}