Transformers
Inference Endpoints
test / v_stable_diffusion.py
vorstcavry's picture
Upload v_stable_diffusion.py
ea96696
# -*- coding: utf-8 -*-
"""V-Stable-diffusion (7).ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/15g1UiV6zBR7pa83BVSCXm5UQdc3-uO-h
<CENTER><font color="#FFD700">V Stable Diffusion</font> <center/>
<img src="https://user-images.githubusercontent.com/73097560/115834477-dbab4500-a447-11eb-908a-139a6edaec5c.gif" width="800" height="18">
<center>
*Bagi yang mau support saya bisa menuju Saweria, KO-FI dan Trakteer dibawah ini*
<center>
*For those who want to support me, you can go to Saweria, KO-FI and Trakteer below*
<center/>
<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>
<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>
<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/>
### Conda
"""
import os
import time
import json
import base64
import shutil
import subprocess
import threading
import sys
import random
import string
from IPython.display import display, HTML
from IPython.display import clear_output
from IPython.utils import capture
from pydantic import BaseModel
def run_command(command, message):
print(f"{message}")
subprocess.run(command, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
print(f"done")
print("\033[92mMenginstall gradio_client\033[0m")
run_command('pip install -q gradio_client==0.2.7', 'install gradio_client...')
clear_output(wait=True)
print("\033[92mMenginstall colablib\033[0m")
run_command('pip install -q git+https://github.com/Linaqruf/colablib', 'install colablib...')
clear_output(wait=True)
print("\033[92mMenginstall Upgrade urllib\033[0m")
run_command('pip install -q --upgrade urllib3 chardet charset_normalizer requests', 'install upgrade urllib3 chardet charset_normalizer requests...')
clear_output(wait=True)
print("\033[92mMenginstall gradio\033[0m")
run_command('pip install -U gradio', 'install gradio...')
clear_output(wait=True)
from colablib.utils.py_utils import get_filename
from typing import List, Optional
from colablib.colored_print import cprint, print_line
from colablib.utils import py_utils, config_utils, package_utils
from colablib.utils.config_utils import pastebin_reader as read
from colablib.utils.ubuntu_utils import ubuntu_deps
from colablib.sd_models.downloader import aria2_download, download, get_modelname
from colablib.utils.ubuntu_utils import unionfuse
from colablib.utils.config_utils import read_config
from colablib.utils.git_utils import clone_repo
from colablib.utils.git_utils import update_repo, batch_update, validate_repo, reset_repo, patch_repo
from colablib.colored_print import cprint as cp
from urllib.parse import urlparse
def run_command(command, message):
print(f"{message}")
subprocess.run(command, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
print(f"done")
cp("Menginstall Conda", color='flat_green')
run_command('conda install -q -y conda', 'installing Conda...')
clear_output(wait=True)
cp("Menginstall Python", color='flat_green')
run_command('conda install -q -y python=3.10.12', 'installing Python 3.10.12...')
clear_output(wait=True)
cp("Menginstall Python glib", color='flat_green')
run_command('conda install -q -y -c conda-forge glib', 'installing glib...')
clear_output(wait=True)
cp("Menginstall aria2", color='flat_green')
run_command('conda install -q -y -c conda-forge aria2', 'installing aria2...')
clear_output(wait=True)
cp("MengUpdate Conda", color='flat_green')
run_command('conda update -q -y -n base -c defaults conda', 'updating Conda...')
clear_output(wait=True)
cp("Menginstall opencv-python;", color='flat_green')
run_command('pip install -q opencv-python', 'installing opencv-python...')
clear_output(wait=True)
cp("Menginstall httpx", color='flat_green')
run_command('pip install -q httpx==0.24.1', 'installing httpx...')
clear_output(wait=True)
cp("Menginstall torch", color='flat_green')
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...')
clear_output(wait=True)
cp("Menginstall xformers", color='flat_green')
run_command('pip install -q xformers==0.0.20 triton==2.0.0 -U', 'installing xformers...')
clear_output(wait=True)
cp("Menginstall GroundingDINO", color='flat_green')
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..')
clear_output(wait=True)
cp("Selesai Menginstall", color='flat_green')
clear_output(wait=True)
cp("Selesai Menginstall, Lanjutkan Ke Proses Selanjutnya", color='flat_green')
"""### CONTOH TAMPILAN UI/UX STABLE DIFFUSION"""
#@title <font size="5"><font color="#FFFF5F">**Preview Tema :**</font>
#@markdown untuk melihat preview semua tema yang bisa dipakai klik tombol [ < ] atau [ > ]
#https://www.w3schools.com/w3css/w3css_slideshow.asp
import IPython
IPython.display.HTML(
'''
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<style>
.mySlides {display:none;}
</style>
<body>
<div class="w3-content w3-display-container">
<div class="w3-display-container mySlides">
<img src="https://i.ibb.co/wCW7tXK/AUTOMATIC1111.png" style="width:100%">
</div>
<div class="w3-display-container mySlides">
<img src="https://i.ibb.co/MNXrf1F/CATPPUCIN.png" style="width:100%">
</div>
<div class="w3-display-container mySlides">
<img src="https://i.ibb.co/KX77dNp/DEVDARK.png" style="width:100%">
</div>
<div class="w3-display-container mySlides">
<img src="https://i.ibb.co/cwG2yGS/DOKI-Jupiter.png" style="width:100%">
</div>
<div class="w3-display-container mySlides">
<img src="https://i.ibb.co/fqTX9Bp/LINAQRUF.png" style="width:100%">
</div>
<div class="w3-display-container mySlides">
<img src="https://i.ibb.co/NrTPNbr/Nocypt-Miku.png" style="width:100%">
</div>
<div class="w3-display-container mySlides">
<img src="https://i.ibb.co/7ggWwwS/KITCHEN.png" style="width:100%">
</div>
<div class="w3-display-container mySlides">
<img src="https://i.ibb.co/2j2DQxD/LOBEHUB.png" style="width:100%">
</div>
<div class="w3-display-container mySlides">
<img src="https://i.ibb.co/TMxwBR2/ANAPNOE.png" style="width:100%">
</div>
<button class="w3-button w3-display-left w3-black" onclick="plusDivs(-1)">&#10094;</button>
<button class="w3-button w3-display-right w3-black" onclick="plusDivs(1)">&#10095;</button>
</div>
<script>
var slideIndex = 1;
showDivs(slideIndex);
function plusDivs(n) {
showDivs(slideIndex += n);
}
function showDivs(n) {
var i;
var x = document.getElementsByClassName("mySlides");
if (n > x.length) {slideIndex = 1}
if (n < 1) {slideIndex = x.length}
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
x[slideIndex-1].style.display = "block";
}
</script>
</body>
</html>
''')
"""### Clone SD"""
# Commented out IPython magic to ensure Python compatibility.
from IPython.display import clear_output
#@markdown <font size="3"><font color="#00F090">**Pilih Tema:**</font>
#@markdown > Tema `Anapnoe`, `Lobehub` dan `Kitchen` cocok untuk pengguna Mobile.
tema = "automatic1111" #@param ["automatic1111","catppuccin", "doki-jupiter", "linaqruf", "nocrypt-miku", "devdark", "anapnoe", "lobehub", "kitchen"]
def git_clone(url, folder_path):
os.makedirs(folder_path, exist_ok=True)
subprocess.run(['git', 'clone', url, folder_path])
def git_checkout(commit_hash, folder_path):
os.chdir(folder_path)
subprocess.run(['git', 'checkout', commit_hash])
def delete_directory(path):
try:
os.system(f"rm -rf {path}")
except Exception as e:
print(f"nothing: {str(e)}")
if (tema == "automatic1111") :
url = 'https://tinyurl.com/Vorst-Cavry-Auto1111'
folder_path = '/home/studio-lab-user/vorst-cavry'
git_clone(url, folder_path)
clear_output(wait=True)
cp("Menggunakan Tema Automatic1111", color='flat_green')
elif (tema == "catppuccin") :
url = 'https://tinyurl.com/Vorst-Cavry-Auto1111'
folder_path = '/home/studio-lab-user/vorst-cavry'
git_clone(url, folder_path)
clear_output(wait=True)
repo_url = 'https://tinyurl.com/CATPPUCCIN-Repo'
destination_folder = '/home/studio-lab-user/vorst-cavry/extensions/catppuccin-theme'
git_clone(repo_url, destination_folder)
clear_output(wait=True)
cp("Menggunakan Tema Catppuccin", color='flat_green')
elif (tema == "doki-jupiter") :
url = 'https://tinyurl.com/Vorst-Cavry-Auto1111'
folder_path = '/home/studio-lab-user/vorst-cavry'
git_clone(url, folder_path)
clear_output(wait=True)
repo_url = 'https://github.com/vorstcavry/doki-theme'
destination_folder = '/home/studio-lab-user/vorst-cavry/extensions/doki-theme'
git_clone(repo_url, destination_folder)
clear_output(wait=True)
cp("Menggunakan Tema Doki", color='flat_green')
elif (tema == "linaqruf") :
url = 'https://tinyurl.com/Vorst-Cavry-Auto1111'
folder_path = '/home/studio-lab-user/vorst-cavry'
git_clone(url, folder_path)
clear_output(wait=True)
url = 'https://huggingface.co/vorstcavry/test/resolve/main/ui-config.json'
output_directory = os.path.join(repo_dir)
download_with_aria2(url, output_directory)
url = 'https://huggingface.co/vorstcavry/test/resolve/main/config.json'
output_directory = os.path.join(repo_dir)
download_with_aria2(url, output_directory)
clear_output(wait=True)
cp("Menggunakan Tema Linaqruf", color='flat_green')
elif (tema == "nocrypt-miku") :
url = 'https://tinyurl.com/Vorst-Cavry-Auto1111'
folder_path = '/home/studio-lab-user/vorst-cavry'
git_clone(url, folder_path)
clear_output(wait=True)
# %cd ~/vorst-cavry
!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
!unzip -o ui.zip
!rm ui.zip
clear_output(wait=True)
cp("Menggunakan Tema Nocrypt Miku", color='flat_green')
elif (tema == "devdark") :
url = 'https://tinyurl.com/Vorst-Cavry-Auto1111'
folder_path = '/home/studio-lab-user/vorst-cavry'
git_clone(url, folder_path)
clear_output(wait=True)
repo_url = 'https://tinyurl.com/Devdark-Theme'
destination_folder = '/home/studio-lab-user/vorst-cavry/extensions/devdark-theme'
git_clone(repo_url, destination_folder)
clear_output(wait=True)
cp("Menggunakan Tema Devdark", color='flat_green')
elif (tema == "anapnoe") :
repo_url = 'https://tinyurl.com/Anapnoe-ux-Repo'
destination_folder = '/home/studio-lab-user/vorst-cavry'
git_clone(repo_url, destination_folder)
clear_output(wait=True)
cp("Menggunakan Tema Anepnoe", color='flat_green')
cp("Mempersiapkan Timmer", color='flat_green')
repo_url = 'https://github.com/vorstcavry/ncpt_colab_timer'
destination_folder = '/home/studio-lab-user/vorst-cavry/extensions/ncpt_colab_timer'
git_clone(repo_url, destination_folder)
repo_url = 'https://github.com/vorstcavry/ncpt_colab_timer'
destination_folder = '/home/studio-lab-user/vorst-cavry/static'
git_clone(repo_url, destination_folder)
import time
try:
start_sagemaker
except:
start_sagemaker = int(time.time())-5
!echo -n {start_sagemaker} > /home/studio-lab-user/vorst-cavry/static/colabTimer.txt
cp("Mempersiapkan Folder tambahan", color='flat_green')
!ln -vs /tmp ~/tmp
!ln -vs /tmp/outputs /home/studio-lab-user/vorst-cavry/outputs
!ln -vs /tmp/models /home/studio-lab-user/vorst-cavry/models/Stable-diffusion/tmp_models
!mkdir ~/vorst-cavry/models/Lora
!ln -vs /tmp/Lora /home/studio-lab-user/vorst-cavry/models/Lora/tmp_Lora
!rm -r /home/studio-lab-user/.cache
cp("Selesai Mempersiapkan folder tambahan", color='flat_green')
"""### *Extensions*"""
# Commented out IPython magic to ensure Python compatibility.
# extensions
# %cd ~/vorst-cavry/extensions
cp("Mempersiapkan Extension", color='flat_green')
!git clone --depth 1 https://github.com/etherealxx/batchlinks-webui
cp("Mempersiapkan Extension", color='flat_green')
clear_output(wait=True)
cp("Mempersiapkan Extension", color='flat_green')
!git clone --depth 1 https://github.com/vorstcavry/images-browser
cp("Mempersiapkan Extension", color='flat_green')
clear_output(wait=True)
cp("Mempersiapkan Extension", color='flat_green')
!git clone --depth 1 https://github.com/DominikDoom/a1111-sd-webui-tagcomplete
cp("Mempersiapkan Extension", color='flat_green')
clear_output(wait=True)
cp("Mempersiapkan Extension", color='flat_green')
!git clone --depth 1 https://github.com/Iyashinouta/sd-model-downloader
cp("Mempersiapkan Extension", color='flat_green')
clear_output(wait=True)
cp("Mempersiapkan Extension", color='flat_green')
!git clone --depth 1 https://github.com/NoCrypt/sd_hf_out
cp("Mempersiapkan Extension", color='flat_green')
clear_output(wait=True)
cp("Mempersiapkan Extension", color='flat_green')
!git clone --depth 1 https://tinyurl.com/additional-networks-s
cp("Mempersiapkan Extension", color='flat_green')
clear_output(wait=True)
cp("Mempersiapkan Extension", color='flat_green')
!git clone --depth 1 https://github.com/NoCrypt/inpaint-nav
cp("Mempersiapkan Extension", color='flat_green')
clear_output(wait=True)
cp("Mempersiapkan Extension", color='flat_green')
!git clone --depth 1 https://github.com/BlafKing/sd-civitai-browser-plus
cp("Mempersiapkan Extension", color='flat_green')
clear_output(wait=True)
cp("Mempersiapkan Extension", color='flat_green')
!git clone --depth 1 https://tinyurl.com/aspect-ratio-v
clear_output(wait=True)
#!git clone
#!git clone
#!git clone
#!git clone
#!git clone
#!git clone
#!git clone
cp("Selesai Mempersiapkan Extension", color='flat_green')
"""#### *ControlNET* (optional)"""
# Commented out IPython magic to ensure Python compatibility.
# persistent
# %cd ~/vorst-cavry/extensions
cp("Mempersiapkan ControlNET", color='flat_green')
!git clone -b v1.1.416 https://tinyurl.com/controlnet-s
clear_output(wait=True)
!rm -rd ~/vorst-cavry/extensions/sd-webui-controlnet/models
cp("Mempersiapkan CntrolNET", color='flat_green')
!git clone --depth 1 https://github.com/fkunn1326/openpose-editor
clear_output(wait=True)
#git clone --depth 1 https://github.com/nonnonstop/sd-webui-3d-open-pose-editor
!git clone --depth 1 https://github.com/hnmr293/posex
!git clone --depth 1 https://github.com/IDEA-Research/DWPose
!ln -vs /tmp/controlnet_models /home/studio-lab-user/vorst-cavry/extensions/sd-webui-controlnet/models
clear_output(wait=True)
cp("Selesai Mempersiapkan ControlNET", color='flat_green')
# Commented out IPython magic to ensure Python compatibility.
# tmp
!mkdir -p /tmp/controlnet_models
clear_output(wait=True)
# %cd ~/vorst-cavry/extensions/sd-webui-controlnet/models
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Bahan ControlNET", color='flat_green')
!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
clear_output(wait=True)
cp("Selesai Mempersiapkan Bahan ControlNET", color='flat_green')
#import os
#from tqdm import tqdm
#packages = [
## "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",
# "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",
# "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",
# "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",
# "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"
#]
#for install in tqdm(packages, desc=print("Install controlnet...")):
# os.system(install)
"""### *Embeddings - Upscaler - VAE*"""
# Commented out IPython magic to ensure Python compatibility.
# embeddings
# %cd ~/vorst-cavry/embeddings
cp("Mempersiapkan embeddings", color='flat_green')
!git clone https://github.com/vorstcavry/embeddings /home/studio-lab-user/vorst-cavry/embeddings/negative
clear_output(wait=True)
cp("Selesai Mempersiapkan embeddings", color='flat_green')
# Upscaler
!mkdir ~/vorst-cavry/models/ESRGAN
# %cd ~/vorst-cavry/models/ESRGAN
cp("Mempersiapkan Upscaler", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Upscaler", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Upscaler", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Upscaler", color='flat_green')
!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
clear_output(wait=True)
cp("Selesai Mempersiapkan Upscaler", color='flat_green')
# VAE
# %cd ~/vorst-cavry/models/VAE
cp("Mempersiapkan VAE", color='flat_green')
!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
#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
#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
#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
#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
clear_output(wait=True)
cp("Selesai Mempersiapkan VAE", color='flat_green')
clear_output(wait=True)
cp("Selesai Mempersiapkan Bahan Tambahan", color='flat_green')
"""### *Checkpoint*"""
# Commented out IPython magic to ensure Python compatibility.
# persistent
# %cd ~/vorst-cavry/models/Stable-diffusion
#!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/77744 -o Meichidark_Mix_V2.safetensors
# Commented out IPython magic to ensure Python compatibility.
# tmp
!mkdir -p /tmp/models
clear_output(wait=True)
# %cd ~/vorst-cavry/models/Stable-diffusion/tmp_models
cp("Mempersiapkan Model", color='flat_green')
!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
clear_output(wait=True)
cp("Mempersiapkan Model", color='flat_green')
!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
clear_output(wait=True)
cp("Selesai Mempersiapkan Model", color='flat_green')
"""### *Lora*"""
# Commented out IPython magic to ensure Python compatibility.
# persistent
# %cd ~/vorst-cavry/models/Lora
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/87153 -o add_detail.safetensors
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/171989 -o detail_slider_v4.safetensors
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/62833 -o Detail_Tweaker.safetensors
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/86247 -o flat2.safetensors
# Commented out IPython magic to ensure Python compatibility.
# tmp
!mkdir -p /tmp/Lora
# %cd ~/vorst-cavry/models/Lora/tmp_Lora
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/87153 -o add_detail.safetensors
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/171989 -o detail_slider_v4.safetensors
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/62833 -o Detail_Tweaker.safetensors
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/86247 -o flat2.safetensors
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/146600 -o breastsizeslideroffset.safetensors
"""## *WEB UI*
- Output images are temporary
"""
# Commented out IPython magic to ensure Python compatibility.
cp("Memilih Versi Stable Difusion", color='flat_green')
repo = "update" #@param ["update", "standar", "default"]
def git_checkout(commit_hash, folder_path):
os.chdir(folder_path)
subprocess.run(['git', 'checkout', commit_hash])
if (repo == "update"):
# %cd /home/studio-lab-user/vorst-cavry
!git pull
!git reset --hard
!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
clear_output(wait=True)
cp("Menggunakan Versi Terbaru", color='flat_green')
elif (repo == "standar"):
# %cd /home/studio-lab-user/vorst-cavry
folder_path = '/home/studio-lab-user/vorst-cavry'
commit_hash = 'baf6946e06249c5af9851c60171692c44ef633e0'
git_checkout(commit_hash, folder_path)
!sed -i -e '''/from modules import launch_utils/a\import os''' /home/studio-lab-user/vorst-cavry/launch.py
!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
!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
clear_output(wait=True)
cp("Menggunakan Versi 1.5", color='flat_green')
elif (repo == "default"):
!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
clear_output(wait=True)
cp("Menggunakan Stable Diffusion 1.6", color='flat_green')