Transformers
Inference Endpoints
vorstcavry commited on
Commit
ea96696
1 Parent(s): dea9ee5

Upload v_stable_diffusion.py

Browse files
Files changed (1) hide show
  1. v_stable_diffusion.py +601 -0
v_stable_diffusion.py ADDED
@@ -0,0 +1,601 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ """V-Stable-diffusion (7).ipynb
3
+
4
+ Automatically generated by Colaboratory.
5
+
6
+ Original file is located at
7
+ https://colab.research.google.com/drive/15g1UiV6zBR7pa83BVSCXm5UQdc3-uO-h
8
+
9
+ <CENTER><font color="#FFD700">V Stable Diffusion</font> <center/>
10
+
11
+ <img src="https://user-images.githubusercontent.com/73097560/115834477-dbab4500-a447-11eb-908a-139a6edaec5c.gif" width="800" height="18">
12
+ <center>
13
+ *Bagi yang mau support saya bisa menuju Saweria, KO-FI dan Trakteer dibawah ini*
14
+ <center>
15
+ *For those who want to support me, you can go to Saweria, KO-FI and Trakteer below*
16
+ <center/>
17
+ <center><a href="https://saweria.co/VorstCavry"><img alt="Saweria" src="https://img.shields.io/badge/Saweria-7B3F00?style=for-the-badge&logo=ko-fi&logoColor=white"/></a> <a href="https://ko-fi.com/vorstcavry"><img alt="KO-FI" src="https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white "/></a> <a href="https://trakteer.id/vorstcavry/tip"><img alt="YOUTUBE" src="https://img.shields.io/badge/trakteer-F16061?style=for-the-badge&logo=buy-me-a-coffee&logoColor=white"/></a><a> <a href="https://www.youtube.com/@remajapekalongan"><img alt="YOUTUBE" src="https://img.shields.io/badge/YouTube-%23FF0000?style=for-the-badge&logo=YouTube&logoColor=white"/></a>
18
+ <a href="https://www.paypal.com/paypalme/vorstcavry?country.x=ID&locale.x=id_ID"><img alt="PAYPAL" src="https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white"/></a>
19
+ <a href="https://www.instagram.com/vorst_cavry/"><img alt="INSTAGRAM" src="https://img.shields.io/badge/Instagram-E4405F?style=for-the-badge&logo=instagram&logoColor=white"/></a> <a href="https://visitorbadge.io/status?path=https%3A%2F%2Fgithub.com%2Fvorstcavry"><img src="https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2Fvorstcavry&label=VISITORS&countColor=%23263759&labelStyle=none" /></a><center/>
20
+
21
+ ### Conda
22
+ """
23
+
24
+ import os
25
+ import time
26
+ import json
27
+ import base64
28
+ import shutil
29
+ import subprocess
30
+ import threading
31
+ import sys
32
+ import random
33
+ import string
34
+ from IPython.display import display, HTML
35
+ from IPython.display import clear_output
36
+ from IPython.utils import capture
37
+ from pydantic import BaseModel
38
+
39
+ def run_command(command, message):
40
+ print(f"{message}")
41
+ subprocess.run(command, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
42
+ print(f"done")
43
+ print("\033[92mMenginstall gradio_client\033[0m")
44
+ run_command('pip install -q gradio_client==0.2.7', 'install gradio_client...')
45
+ clear_output(wait=True)
46
+ print("\033[92mMenginstall colablib\033[0m")
47
+ run_command('pip install -q git+https://github.com/Linaqruf/colablib', 'install colablib...')
48
+ clear_output(wait=True)
49
+ print("\033[92mMenginstall Upgrade urllib\033[0m")
50
+ run_command('pip install -q --upgrade urllib3 chardet charset_normalizer requests', 'install upgrade urllib3 chardet charset_normalizer requests...')
51
+ clear_output(wait=True)
52
+ print("\033[92mMenginstall gradio\033[0m")
53
+ run_command('pip install -U gradio', 'install gradio...')
54
+ clear_output(wait=True)
55
+
56
+ from colablib.utils.py_utils import get_filename
57
+ from typing import List, Optional
58
+ from colablib.colored_print import cprint, print_line
59
+ from colablib.utils import py_utils, config_utils, package_utils
60
+ from colablib.utils.config_utils import pastebin_reader as read
61
+ from colablib.utils.ubuntu_utils import ubuntu_deps
62
+ from colablib.sd_models.downloader import aria2_download, download, get_modelname
63
+ from colablib.utils.ubuntu_utils import unionfuse
64
+ from colablib.utils.config_utils import read_config
65
+ from colablib.utils.git_utils import clone_repo
66
+ from colablib.utils.git_utils import update_repo, batch_update, validate_repo, reset_repo, patch_repo
67
+ from colablib.colored_print import cprint as cp
68
+ from urllib.parse import urlparse
69
+
70
+
71
+ def run_command(command, message):
72
+ print(f"{message}")
73
+ subprocess.run(command, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
74
+ print(f"done")
75
+ cp("Menginstall Conda", color='flat_green')
76
+ run_command('conda install -q -y conda', 'installing Conda...')
77
+ clear_output(wait=True)
78
+ cp("Menginstall Python", color='flat_green')
79
+ run_command('conda install -q -y python=3.10.12', 'installing Python 3.10.12...')
80
+ clear_output(wait=True)
81
+ cp("Menginstall Python glib", color='flat_green')
82
+ run_command('conda install -q -y -c conda-forge glib', 'installing glib...')
83
+ clear_output(wait=True)
84
+ cp("Menginstall aria2", color='flat_green')
85
+ run_command('conda install -q -y -c conda-forge aria2', 'installing aria2...')
86
+ clear_output(wait=True)
87
+ cp("MengUpdate Conda", color='flat_green')
88
+ run_command('conda update -q -y -n base -c defaults conda', 'updating Conda...')
89
+ clear_output(wait=True)
90
+ cp("Menginstall opencv-python;", color='flat_green')
91
+ run_command('pip install -q opencv-python', 'installing opencv-python...')
92
+ clear_output(wait=True)
93
+ cp("Menginstall httpx", color='flat_green')
94
+ run_command('pip install -q httpx==0.24.1', 'installing httpx...')
95
+ clear_output(wait=True)
96
+ cp("Menginstall torch", color='flat_green')
97
+ run_command('pip install -q torch==2.0.1+cu118 torchvision==0.15.2+cu118 torchaudio==2.0.2+cu118 torchtext==0.15.2 torchdata==0.6.1 --extra-index-url https://download.pytorch.org/whl/cu118 -U', 'installing torch...')
98
+ clear_output(wait=True)
99
+ cp("Menginstall xformers", color='flat_green')
100
+ run_command('pip install -q xformers==0.0.20 triton==2.0.0 -U', 'installing xformers...')
101
+ clear_output(wait=True)
102
+ cp("Menginstall GroundingDINO", color='flat_green')
103
+ run_command('pip install -q https://github.com/Bing-su/GroundingDINO/releases/download/0.1.0-2.0.1/groundingdino-0.1.0+torch2.0.1.cu118-cp310-cp310-linux_x86_64.whl -U', 'installing GroundingDINO..')
104
+ clear_output(wait=True)
105
+ cp("Selesai Menginstall", color='flat_green')
106
+ clear_output(wait=True)
107
+ cp("Selesai Menginstall, Lanjutkan Ke Proses Selanjutnya", color='flat_green')
108
+
109
+ """### CONTOH TAMPILAN UI/UX STABLE DIFFUSION"""
110
+
111
+ #@title <font size="5"><font color="#FFFF5F">**Preview Tema :**</font>
112
+ #@markdown untuk melihat preview semua tema yang bisa dipakai klik tombol [ < ] atau [ > ]
113
+
114
+ #https://www.w3schools.com/w3css/w3css_slideshow.asp
115
+ import IPython
116
+ IPython.display.HTML(
117
+
118
+ '''
119
+
120
+ <html>
121
+ <title>W3.CSS</title>
122
+ <meta name="viewport" content="width=device-width, initial-scale=1">
123
+ <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
124
+ <style>
125
+ .mySlides {display:none;}
126
+ </style>
127
+ <body>
128
+
129
+ <div class="w3-content w3-display-container">
130
+
131
+ <div class="w3-display-container mySlides">
132
+ <img src="https://i.ibb.co/wCW7tXK/AUTOMATIC1111.png" style="width:100%">
133
+ </div>
134
+
135
+ <div class="w3-display-container mySlides">
136
+ <img src="https://i.ibb.co/MNXrf1F/CATPPUCIN.png" style="width:100%">
137
+ </div>
138
+
139
+ <div class="w3-display-container mySlides">
140
+ <img src="https://i.ibb.co/KX77dNp/DEVDARK.png" style="width:100%">
141
+ </div>
142
+
143
+ <div class="w3-display-container mySlides">
144
+ <img src="https://i.ibb.co/cwG2yGS/DOKI-Jupiter.png" style="width:100%">
145
+ </div>
146
+
147
+ <div class="w3-display-container mySlides">
148
+ <img src="https://i.ibb.co/fqTX9Bp/LINAQRUF.png" style="width:100%">
149
+ </div>
150
+
151
+ <div class="w3-display-container mySlides">
152
+ <img src="https://i.ibb.co/NrTPNbr/Nocypt-Miku.png" style="width:100%">
153
+ </div>
154
+
155
+ <div class="w3-display-container mySlides">
156
+ <img src="https://i.ibb.co/7ggWwwS/KITCHEN.png" style="width:100%">
157
+ </div>
158
+
159
+ <div class="w3-display-container mySlides">
160
+ <img src="https://i.ibb.co/2j2DQxD/LOBEHUB.png" style="width:100%">
161
+ </div>
162
+
163
+ <div class="w3-display-container mySlides">
164
+ <img src="https://i.ibb.co/TMxwBR2/ANAPNOE.png" style="width:100%">
165
+ </div>
166
+
167
+
168
+ <button class="w3-button w3-display-left w3-black" onclick="plusDivs(-1)">&#10094;</button>
169
+ <button class="w3-button w3-display-right w3-black" onclick="plusDivs(1)">&#10095;</button>
170
+
171
+ </div>
172
+
173
+ <script>
174
+ var slideIndex = 1;
175
+ showDivs(slideIndex);
176
+
177
+ function plusDivs(n) {
178
+ showDivs(slideIndex += n);
179
+ }
180
+
181
+ function showDivs(n) {
182
+ var i;
183
+ var x = document.getElementsByClassName("mySlides");
184
+ if (n > x.length) {slideIndex = 1}
185
+ if (n < 1) {slideIndex = x.length}
186
+ for (i = 0; i < x.length; i++) {
187
+ x[i].style.display = "none";
188
+ }
189
+ x[slideIndex-1].style.display = "block";
190
+ }
191
+ </script>
192
+
193
+ </body>
194
+ </html>
195
+
196
+ ''')
197
+
198
+ """### Clone SD"""
199
+
200
+ # Commented out IPython magic to ensure Python compatibility.
201
+ from IPython.display import clear_output
202
+
203
+ #@markdown <font size="3"><font color="#00F090">**Pilih Tema:**</font>
204
+ #@markdown > Tema `Anapnoe`, `Lobehub` dan `Kitchen` cocok untuk pengguna Mobile.
205
+ tema = "automatic1111" #@param ["automatic1111","catppuccin", "doki-jupiter", "linaqruf", "nocrypt-miku", "devdark", "anapnoe", "lobehub", "kitchen"]
206
+
207
+ def git_clone(url, folder_path):
208
+ os.makedirs(folder_path, exist_ok=True)
209
+ subprocess.run(['git', 'clone', url, folder_path])
210
+
211
+ def git_checkout(commit_hash, folder_path):
212
+ os.chdir(folder_path)
213
+ subprocess.run(['git', 'checkout', commit_hash])
214
+
215
+ def delete_directory(path):
216
+ try:
217
+ os.system(f"rm -rf {path}")
218
+ except Exception as e:
219
+ print(f"nothing: {str(e)}")
220
+
221
+
222
+ if (tema == "automatic1111") :
223
+ url = 'https://tinyurl.com/Vorst-Cavry-Auto1111'
224
+ folder_path = '/home/studio-lab-user/vorst-cavry'
225
+ git_clone(url, folder_path)
226
+ clear_output(wait=True)
227
+ cp("Menggunakan Tema Automatic1111", color='flat_green')
228
+ elif (tema == "catppuccin") :
229
+ url = 'https://tinyurl.com/Vorst-Cavry-Auto1111'
230
+ folder_path = '/home/studio-lab-user/vorst-cavry'
231
+ git_clone(url, folder_path)
232
+ clear_output(wait=True)
233
+ repo_url = 'https://tinyurl.com/CATPPUCCIN-Repo'
234
+ destination_folder = '/home/studio-lab-user/vorst-cavry/extensions/catppuccin-theme'
235
+ git_clone(repo_url, destination_folder)
236
+ clear_output(wait=True)
237
+ cp("Menggunakan Tema Catppuccin", color='flat_green')
238
+ elif (tema == "doki-jupiter") :
239
+ url = 'https://tinyurl.com/Vorst-Cavry-Auto1111'
240
+ folder_path = '/home/studio-lab-user/vorst-cavry'
241
+ git_clone(url, folder_path)
242
+ clear_output(wait=True)
243
+ repo_url = 'https://github.com/vorstcavry/doki-theme'
244
+ destination_folder = '/home/studio-lab-user/vorst-cavry/extensions/doki-theme'
245
+ git_clone(repo_url, destination_folder)
246
+ clear_output(wait=True)
247
+ cp("Menggunakan Tema Doki", color='flat_green')
248
+ elif (tema == "linaqruf") :
249
+ url = 'https://tinyurl.com/Vorst-Cavry-Auto1111'
250
+ folder_path = '/home/studio-lab-user/vorst-cavry'
251
+ git_clone(url, folder_path)
252
+ clear_output(wait=True)
253
+ url = 'https://huggingface.co/vorstcavry/test/resolve/main/ui-config.json'
254
+ output_directory = os.path.join(repo_dir)
255
+ download_with_aria2(url, output_directory)
256
+ url = 'https://huggingface.co/vorstcavry/test/resolve/main/config.json'
257
+ output_directory = os.path.join(repo_dir)
258
+ download_with_aria2(url, output_directory)
259
+ clear_output(wait=True)
260
+ cp("Menggunakan Tema Linaqruf", color='flat_green')
261
+ elif (tema == "nocrypt-miku") :
262
+ url = 'https://tinyurl.com/Vorst-Cavry-Auto1111'
263
+ folder_path = '/home/studio-lab-user/vorst-cavry'
264
+ git_clone(url, folder_path)
265
+ clear_output(wait=True)
266
+ # %cd ~/vorst-cavry
267
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/vorstcavry/ui/resolve/main/ui.zip?download=true -o ui.zip
268
+ !unzip -o ui.zip
269
+ !rm ui.zip
270
+ clear_output(wait=True)
271
+ cp("Menggunakan Tema Nocrypt Miku", color='flat_green')
272
+ elif (tema == "devdark") :
273
+ url = 'https://tinyurl.com/Vorst-Cavry-Auto1111'
274
+ folder_path = '/home/studio-lab-user/vorst-cavry'
275
+ git_clone(url, folder_path)
276
+ clear_output(wait=True)
277
+ repo_url = 'https://tinyurl.com/Devdark-Theme'
278
+ destination_folder = '/home/studio-lab-user/vorst-cavry/extensions/devdark-theme'
279
+ git_clone(repo_url, destination_folder)
280
+ clear_output(wait=True)
281
+ cp("Menggunakan Tema Devdark", color='flat_green')
282
+ elif (tema == "anapnoe") :
283
+ repo_url = 'https://tinyurl.com/Anapnoe-ux-Repo'
284
+ destination_folder = '/home/studio-lab-user/vorst-cavry'
285
+ git_clone(repo_url, destination_folder)
286
+ clear_output(wait=True)
287
+ cp("Menggunakan Tema Anepnoe", color='flat_green')
288
+
289
+ cp("Mempersiapkan Timmer", color='flat_green')
290
+ repo_url = 'https://github.com/vorstcavry/ncpt_colab_timer'
291
+ destination_folder = '/home/studio-lab-user/vorst-cavry/extensions/ncpt_colab_timer'
292
+ git_clone(repo_url, destination_folder)
293
+ repo_url = 'https://github.com/vorstcavry/ncpt_colab_timer'
294
+ destination_folder = '/home/studio-lab-user/vorst-cavry/static'
295
+ git_clone(repo_url, destination_folder)
296
+
297
+
298
+
299
+ import time
300
+ try:
301
+ start_sagemaker
302
+ except:
303
+ start_sagemaker = int(time.time())-5
304
+ !echo -n {start_sagemaker} > /home/studio-lab-user/vorst-cavry/static/colabTimer.txt
305
+
306
+ cp("Mempersiapkan Folder tambahan", color='flat_green')
307
+ !ln -vs /tmp ~/tmp
308
+ !ln -vs /tmp/outputs /home/studio-lab-user/vorst-cavry/outputs
309
+ !ln -vs /tmp/models /home/studio-lab-user/vorst-cavry/models/Stable-diffusion/tmp_models
310
+ !mkdir ~/vorst-cavry/models/Lora
311
+ !ln -vs /tmp/Lora /home/studio-lab-user/vorst-cavry/models/Lora/tmp_Lora
312
+ !rm -r /home/studio-lab-user/.cache
313
+ cp("Selesai Mempersiapkan folder tambahan", color='flat_green')
314
+
315
+ """### *Extensions*"""
316
+
317
+ # Commented out IPython magic to ensure Python compatibility.
318
+ # extensions
319
+ # %cd ~/vorst-cavry/extensions
320
+ cp("Mempersiapkan Extension", color='flat_green')
321
+ !git clone --depth 1 https://github.com/etherealxx/batchlinks-webui
322
+ cp("Mempersiapkan Extension", color='flat_green')
323
+ clear_output(wait=True)
324
+ cp("Mempersiapkan Extension", color='flat_green')
325
+ !git clone --depth 1 https://github.com/vorstcavry/images-browser
326
+ cp("Mempersiapkan Extension", color='flat_green')
327
+ clear_output(wait=True)
328
+ cp("Mempersiapkan Extension", color='flat_green')
329
+ !git clone --depth 1 https://github.com/DominikDoom/a1111-sd-webui-tagcomplete
330
+ cp("Mempersiapkan Extension", color='flat_green')
331
+ clear_output(wait=True)
332
+ cp("Mempersiapkan Extension", color='flat_green')
333
+ !git clone --depth 1 https://github.com/Iyashinouta/sd-model-downloader
334
+ cp("Mempersiapkan Extension", color='flat_green')
335
+ clear_output(wait=True)
336
+ cp("Mempersiapkan Extension", color='flat_green')
337
+ !git clone --depth 1 https://github.com/NoCrypt/sd_hf_out
338
+ cp("Mempersiapkan Extension", color='flat_green')
339
+ clear_output(wait=True)
340
+ cp("Mempersiapkan Extension", color='flat_green')
341
+ !git clone --depth 1 https://tinyurl.com/additional-networks-s
342
+ cp("Mempersiapkan Extension", color='flat_green')
343
+ clear_output(wait=True)
344
+ cp("Mempersiapkan Extension", color='flat_green')
345
+ !git clone --depth 1 https://github.com/NoCrypt/inpaint-nav
346
+ cp("Mempersiapkan Extension", color='flat_green')
347
+ clear_output(wait=True)
348
+ cp("Mempersiapkan Extension", color='flat_green')
349
+ !git clone --depth 1 https://github.com/BlafKing/sd-civitai-browser-plus
350
+ cp("Mempersiapkan Extension", color='flat_green')
351
+ clear_output(wait=True)
352
+ cp("Mempersiapkan Extension", color='flat_green')
353
+ !git clone --depth 1 https://tinyurl.com/aspect-ratio-v
354
+ clear_output(wait=True)
355
+ #!git clone
356
+ #!git clone
357
+ #!git clone
358
+ #!git clone
359
+ #!git clone
360
+ #!git clone
361
+ #!git clone
362
+ cp("Selesai Mempersiapkan Extension", color='flat_green')
363
+
364
+ """#### *ControlNET* (optional)"""
365
+
366
+ # Commented out IPython magic to ensure Python compatibility.
367
+ # persistent
368
+ # %cd ~/vorst-cavry/extensions
369
+ cp("Mempersiapkan ControlNET", color='flat_green')
370
+ !git clone -b v1.1.416 https://tinyurl.com/controlnet-s
371
+ clear_output(wait=True)
372
+ !rm -rd ~/vorst-cavry/extensions/sd-webui-controlnet/models
373
+ cp("Mempersiapkan CntrolNET", color='flat_green')
374
+ !git clone --depth 1 https://github.com/fkunn1326/openpose-editor
375
+ clear_output(wait=True)
376
+ #git clone --depth 1 https://github.com/nonnonstop/sd-webui-3d-open-pose-editor
377
+ !git clone --depth 1 https://github.com/hnmr293/posex
378
+ !git clone --depth 1 https://github.com/IDEA-Research/DWPose
379
+
380
+ !ln -vs /tmp/controlnet_models /home/studio-lab-user/vorst-cavry/extensions/sd-webui-controlnet/models
381
+ clear_output(wait=True)
382
+ cp("Selesai Mempersiapkan ControlNET", color='flat_green')
383
+
384
+ # Commented out IPython magic to ensure Python compatibility.
385
+ # tmp
386
+ !mkdir -p /tmp/controlnet_models
387
+ clear_output(wait=True)
388
+ # %cd ~/vorst-cavry/extensions/sd-webui-controlnet/models
389
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
390
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_ip2p_fp16.safetensors -o control_v11e_sd15_ip2p_fp16.safetensors
391
+ clear_output(wait=True)
392
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
393
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_shuffle_fp16.safetensors -o control_v11e_sd15_shuffle_fp16.safetensors
394
+ clear_output(wait=True)
395
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
396
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny_fp16.safetensors -o control_v11p_sd15_canny_fp16.safetensors
397
+ clear_output(wait=True)
398
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
399
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1p_sd15_depth_fp16.safetensors -o control_v11f1p_sd15_depth_fp16.safetensors
400
+ clear_output(wait=True)
401
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
402
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_inpaint_fp16.safetensors -o control_v11p_sd15_inpaint_fp16.safetensors
403
+ clear_output(wait=True)
404
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
405
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart_fp16.safetensors -o control_v11p_sd15_lineart_fp16.safetensors
406
+ clear_output(wait=True)
407
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
408
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_mlsd_fp16.safetensors -o control_v11p_sd15_mlsd_fp16.safetensors
409
+ clear_output(wait=True)
410
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
411
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_normalbae_fp16.safetensors -o control_v11p_sd15_normalbae_fp16.safetensors
412
+ clear_output(wait=True)
413
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
414
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose_fp16.safetensors -o control_v11p_sd15_openpose_fp16.safetensors
415
+ clear_output(wait=True)
416
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
417
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_scribble_fp16.safetensors -o control_v11p_sd15_scribble_fp16.safetensors
418
+ clear_output(wait=True)
419
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
420
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_seg_fp16.safetensors -o control_v11p_sd15_seg_fp16.safetensors
421
+ clear_output(wait=True)
422
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
423
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_softedge_fp16.safetensors -o control_v11p_sd15_softedge_fp16.safetensors
424
+ clear_output(wait=True)
425
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
426
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors -o control_v11p_sd15s2_lineart_anime_fp16.safetensors
427
+ clear_output(wait=True)
428
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
429
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1e_sd15_tile_fp16.safetensors -o control_v11f1e_sd15_tile_fp16.safetensors
430
+ clear_output(wait=True)
431
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
432
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_ip2p_fp16.yaml -o control_v11e_sd15_ip2p_fp16.yaml
433
+ clear_output(wait=True)
434
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
435
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_shuffle_fp16.yaml -o control_v11e_sd15_shuffle_fp16.yaml
436
+ clear_output(wait=True)
437
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
438
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_canny_fp16.yaml -o control_v11p_sd15_canny_fp16.yaml
439
+ clear_output(wait=True)
440
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
441
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11f1p_sd15_depth_fp16.yaml -o control_v11f1p_sd15_depth_fp16.yaml
442
+ clear_output(wait=True)
443
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
444
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_inpaint_fp16.yaml -o control_v11p_sd15_inpaint_fp16.yaml
445
+ clear_output(wait=True)
446
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
447
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_lineart_fp16.yaml -o control_v11p_sd15_lineart_fp16.yaml
448
+ clear_output(wait=True)
449
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
450
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_mlsd_fp16.yaml -o control_v11p_sd15_mlsd_fp16.yaml
451
+ clear_output(wait=True)
452
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
453
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_normalbae_fp16.yaml -o control_v11p_sd15_normalbae_fp16.yaml
454
+ clear_output(wait=True)
455
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
456
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_openpose_fp16.yaml -o control_v11p_sd15_openpose_fp16.yaml
457
+ clear_output(wait=True)
458
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
459
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_scribble_fp16.yaml -o control_v11p_sd15_scribble_fp16.yaml
460
+ clear_output(wait=True)
461
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
462
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_seg_fp16.yaml -o control_v11p_sd15_seg_fp16.yaml
463
+ clear_output(wait=True)
464
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
465
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_softedge_fp16.yaml -o control_v11p_sd15_softedge_fp16.yaml
466
+ clear_output(wait=True)
467
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
468
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15s2_lineart_anime_fp16.yaml -o control_v11p_sd15s2_lineart_anime_fp16.yaml
469
+ clear_output(wait=True)
470
+ cp("Mempersiapkan Bahan ControlNET", color='flat_green')
471
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11f1e_sd15_tile_fp16.yaml -o control_v11f1e_sd15_tile_fp16.yaml
472
+ clear_output(wait=True)
473
+ cp("Selesai Mempersiapkan Bahan ControlNET", color='flat_green')
474
+ #import os
475
+ #from tqdm import tqdm
476
+
477
+ #packages = [
478
+ ## "aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_canny_fp16.safetensors -d /home/studio-lab-user/vorst-cavry/models/ControlNet -o control_v11p_sd15_canny.safetensors",
479
+ # "aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_inpaint_fp16.safetensors -d /home/studio-lab-user/vorst-cavry/models/ControlNet -o control_v11p_sd15_inpaint.safetensors",
480
+ # "aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_lineart_fp16.safetensors -d /home/studio-lab-user/vorst-cavry/models/ControlNet -o control_v11f1p_sd15_depth.safetensors",
481
+ # "aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_openpose_fp16.safetensors -d /home/studio-lab-user/vorst-cavry/models/ControlNet -o control_v11p_sd15_openpose.safetensors",
482
+ # "aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors -d /home/studio-lab-user/vorst-cavry/models/ControlNet -o control_v11p_sd15s2_lineart_anime.safetensors"
483
+ #]
484
+ #for install in tqdm(packages, desc=print("Install controlnet...")):
485
+ # os.system(install)
486
+
487
+ """### *Embeddings - Upscaler - VAE*"""
488
+
489
+ # Commented out IPython magic to ensure Python compatibility.
490
+ # embeddings
491
+ # %cd ~/vorst-cavry/embeddings
492
+ cp("Mempersiapkan embeddings", color='flat_green')
493
+ !git clone https://github.com/vorstcavry/embeddings /home/studio-lab-user/vorst-cavry/embeddings/negative
494
+ clear_output(wait=True)
495
+ cp("Selesai Mempersiapkan embeddings", color='flat_green')
496
+ # Upscaler
497
+ !mkdir ~/vorst-cavry/models/ESRGAN
498
+ # %cd ~/vorst-cavry/models/ESRGAN
499
+ cp("Mempersiapkan Upscaler", color='flat_green')
500
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/utnah/esrgan/resolve/main/8x_NMKD-Faces_160000_G.pth?download=true -o 8x_NMKD-Faces_160000_G.pth
501
+ clear_output(wait=True)
502
+ cp("Mempersiapkan Upscaler", color='flat_green')
503
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/utnah/esrgan/resolve/main/4x-AnimeSharp.pth?download=true -o 4x-AnimeSharp.pth
504
+ clear_output(wait=True)
505
+ cp("Mempersiapkan Upscaler", color='flat_green')
506
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/pantat88/ui/resolve/main/4x_RealisticRescaler_100000_G.pth -o 4x_RealisticRescaler_100000_G.pth
507
+ clear_output(wait=True)
508
+ cp("Mempersiapkan Upscaler", color='flat_green')
509
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/pantat88/ui/resolve/main/8x_RealESRGAN.pth -o 8x_RealESRGAN.pth
510
+ clear_output(wait=True)
511
+ cp("Selesai Mempersiapkan Upscaler", color='flat_green')
512
+ # VAE
513
+ # %cd ~/vorst-cavry/models/VAE
514
+ cp("Mempersiapkan VAE", color='flat_green')
515
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors -o vae-ft-mse-840000-ema-pruned.safetensors
516
+ #aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/fp16-guy/anything_kl-f8-anime2_vae-ft-mse-840000-ema-pruned_blessed_clearvae_fp16_cleaned/resolve/main/kl-f8-anime2_fp16.safetensors -o kl-f8-anime2_fp16.safetensors
517
+ #aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/fp16-guy/anything_kl-f8-anime2_vae-ft-mse-840000-ema-pruned_blessed_clearvae_fp16_cleaned/resolve/main/blessed2_fp16.safetensors -o blessed2_fp16.safetensors
518
+ #aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/fp16-guy/anything_kl-f8-anime2_vae-ft-mse-840000-ema-pruned_blessed_clearvae_fp16_cleaned/resolve/main/ClearVAE_V2.3_fp16.safetensors -o ClearVAE_V2.3_fp16.safetensors
519
+ #aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/fp16-guy/anything_kl-f8-anime2_vae-ft-mse-840000-ema-pruned_blessed_clearvae_fp16_cleaned/resolve/main/anything_fp16.safetensors -o anything_fp16.safetensors
520
+ clear_output(wait=True)
521
+ cp("Selesai Mempersiapkan VAE", color='flat_green')
522
+ clear_output(wait=True)
523
+ cp("Selesai Mempersiapkan Bahan Tambahan", color='flat_green')
524
+
525
+ """### *Checkpoint*"""
526
+
527
+ # Commented out IPython magic to ensure Python compatibility.
528
+ # persistent
529
+ # %cd ~/vorst-cavry/models/Stable-diffusion
530
+
531
+ #!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/77744 -o Meichidark_Mix_V2.safetensors
532
+
533
+ # Commented out IPython magic to ensure Python compatibility.
534
+ # tmp
535
+ !mkdir -p /tmp/models
536
+ clear_output(wait=True)
537
+ # %cd ~/vorst-cavry/models/Stable-diffusion/tmp_models
538
+ cp("Mempersiapkan Model", color='flat_green')
539
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/vorstcavry/mymodel/resolve/main/Cavry_V2.safetensors -o Cavry_V2.safetensors
540
+ clear_output(wait=True)
541
+ cp("Mempersiapkan Model", color='flat_green')
542
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/vorstcavry/mymodel/resolve/main/Cavry_V2.preview.png -o Cavry_V2.preview.png
543
+ clear_output(wait=True)
544
+ cp("Selesai Mempersiapkan Model", color='flat_green')
545
+
546
+ """### *Lora*"""
547
+
548
+ # Commented out IPython magic to ensure Python compatibility.
549
+ # persistent
550
+ # %cd ~/vorst-cavry/models/Lora
551
+
552
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/87153 -o add_detail.safetensors
553
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/171989 -o detail_slider_v4.safetensors
554
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/62833 -o Detail_Tweaker.safetensors
555
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/86247 -o flat2.safetensors
556
+
557
+ # Commented out IPython magic to ensure Python compatibility.
558
+ # tmp
559
+ !mkdir -p /tmp/Lora
560
+ # %cd ~/vorst-cavry/models/Lora/tmp_Lora
561
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/87153 -o add_detail.safetensors
562
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/171989 -o detail_slider_v4.safetensors
563
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/62833 -o Detail_Tweaker.safetensors
564
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/86247 -o flat2.safetensors
565
+ !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/146600 -o breastsizeslideroffset.safetensors
566
+
567
+ """## *WEB UI*
568
+ - Output images are temporary
569
+ """
570
+
571
+ # Commented out IPython magic to ensure Python compatibility.
572
+ cp("Memilih Versi Stable Difusion", color='flat_green')
573
+ repo = "update" #@param ["update", "standar", "default"]
574
+
575
+
576
+ def git_checkout(commit_hash, folder_path):
577
+ os.chdir(folder_path)
578
+ subprocess.run(['git', 'checkout', commit_hash])
579
+
580
+ if (repo == "update"):
581
+ # %cd /home/studio-lab-user/vorst-cavry
582
+ !git pull
583
+ !git reset --hard
584
+ !sed -i -e 's/\["sd_model_checkpoint"\]/\["sd_model_checkpoint","sd_vae","CLIP_stop_at_last_layers"\]/g' /home/studio-lab-user/vorst-cavry/modules/shared_options.py
585
+ clear_output(wait=True)
586
+ cp("Menggunakan Versi Terbaru", color='flat_green')
587
+ elif (repo == "standar"):
588
+ # %cd /home/studio-lab-user/vorst-cavry
589
+ folder_path = '/home/studio-lab-user/vorst-cavry'
590
+ commit_hash = 'baf6946e06249c5af9851c60171692c44ef633e0'
591
+ git_checkout(commit_hash, folder_path)
592
+ !sed -i -e '''/from modules import launch_utils/a\import os''' /home/studio-lab-user/vorst-cavry/launch.py
593
+ !sed -i -e '''/ prepare_environment()/a\ os.system\(f\"""sed -i -e ''\"s/dict()))/dict())).cuda()/g\"'' /home/studio-lab-user/vorst-cavry/repositories/stable-diffusion-stability-ai/ldm/util.py""")''' /home/studio-lab-user/vorst-cavry/launch.py
594
+ !sed -i -e 's/\["sd_model_checkpoint"\]/\["sd_model_checkpoint","sd_vae","CLIP_stop_at_last_layers"\]/g' /home/studio-lab-user/vorst-cavry/modules/shared.py
595
+ clear_output(wait=True)
596
+ cp("Menggunakan Versi 1.5", color='flat_green')
597
+ elif (repo == "default"):
598
+ !sed -i -e 's/\["sd_model_checkpoint"\]/\["sd_model_checkpoint","sd_vae","CLIP_stop_at_last_layers"\]/g' /home/studio-lab-user/vorst-cavry/modules/shared_options.py
599
+ clear_output(wait=True)
600
+ cp("Menggunakan Stable Diffusion 1.6", color='flat_green')
601
+