Upload main.py
Browse files
main.py
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import argparse #line:1
|
| 2 |
+
import binascii #line:2
|
| 3 |
+
def str_to_bool (OO0OO00OO0OO00000 ):#line:5
|
| 4 |
+
if OO0OO00OO0OO00000 .lower ()in ('yes','true','t','y','1'):#line:6
|
| 5 |
+
return True #line:7
|
| 6 |
+
elif OO0OO00OO0OO00000 .lower ()in ('no','false','f','n','0'):#line:8
|
| 7 |
+
return False #line:9
|
| 8 |
+
else :#line:10
|
| 9 |
+
raise argparse .ArgumentTypeError ('Invalid boolean value: {}'.format (OO0OO00OO0OO00000 ))#line:11
|
| 10 |
+
parser =argparse .ArgumentParser ()#line:14
|
| 11 |
+
parser .add_argument ('--UI',type =str )#line:16
|
| 12 |
+
parser .add_argument ('--Version',type =str )#line:17
|
| 13 |
+
parser .add_argument ('--ControlNet',type =str )#line:18
|
| 14 |
+
parser .add_argument ('--Roop',type =str_to_bool )#line:19
|
| 15 |
+
parser .add_argument ('--Drive_Map',type =str_to_bool )#line:20
|
| 16 |
+
parser .add_argument ('--Key_words',type =str_to_bool )#line:21
|
| 17 |
+
parser .add_argument ('--SadTalker',type =str_to_bool )#line:22
|
| 18 |
+
parser .add_argument ('--Segment_Anything',type =str_to_bool )#line:23
|
| 19 |
+
args =parser .parse_args ()#line:26
|
| 20 |
+
UI =args .UI #line:29
|
| 21 |
+
Roop =args .Roop #line:30
|
| 22 |
+
Version =args .Version #line:31
|
| 23 |
+
ControlNet =args .ControlNet #line:32
|
| 24 |
+
Drive_Map =args .Drive_Map #line:33
|
| 25 |
+
Key_words =args .Key_words #line:34
|
| 26 |
+
Segment_Anything =args .Segment_Anything #line:35
|
| 27 |
+
SadTalker =args .SadTalker #line:36
|
| 28 |
+
import sys #line:40
|
| 29 |
+
import os #line:41
|
| 30 |
+
import json #line:42
|
| 31 |
+
import base64 #line:43
|
| 32 |
+
import importlib .util #line:44
|
| 33 |
+
from IPython import get_ipython #line:45
|
| 34 |
+
from IPython .display import clear_output #line:46
|
| 35 |
+
from google .colab import drive #line:47
|
| 36 |
+
import tensorflow as tf #line:48
|
| 37 |
+
print ("TensorFlow version:",tf .__version__ )#line:51
|
| 38 |
+
if tf .test .gpu_device_name ():#line:52
|
| 39 |
+
drive .mount ('/content/drive')#line:53
|
| 40 |
+
else :#line:54
|
| 41 |
+
raise Exception ("\n请在《代码执行程序》-《更改运行时类型》-设置为GPU~")#line:55
|
| 42 |
+
w =base64 .b64decode (("d2VidWk=").encode ('ascii')).decode ('ascii')#line:57
|
| 43 |
+
l =base64 .b64decode (("bGF1bmNo").encode ('ascii')).decode ('ascii')#line:58
|
| 44 |
+
sdw =base64 .b64decode (("c3RhYmxlLWRpZmZ1c2lvbi13ZWJ1aQ==").encode ('ascii')).decode ('ascii')#line:59
|
| 45 |
+
wb =f'/root/main'#line:62
|
| 46 |
+
sai =base64 .b64decode (("c3RhYmxlLWRpZmZ1c2lvbi1zdGFiaWxpdHktYWk=").encode ('ascii')).decode ('ascii')#line:63
|
| 47 |
+
sd =base64 .b64decode (("U3RhYmxlLWRpZmZ1c2lvbg==").encode ('ascii')).decode ('ascii')#line:64
|
| 48 |
+
gwb =f'/content/drive/MyDrive/SD_DATA'#line:65
|
| 49 |
+
get_ipython ().run_line_magic ('cd','/content')#line:67
|
| 50 |
+
get_ipython ().run_line_magic ('env','TF_CPP_MIN_LOG_LEVEL=1')#line:68
|
| 51 |
+
def cloudDriveSync (O000O00OOOOO000O0 ,localPath ='',sync =False ):#line:71
|
| 52 |
+
if not os .path .exists (O000O00OOOOO000O0 ):#line:73
|
| 53 |
+
get_ipython ().system (f'mkdir {O000O00OOOOO000O0}')#line:75
|
| 54 |
+
if not sync :#line:78
|
| 55 |
+
return #line:79
|
| 56 |
+
get_ipython ().system (f'rm -rf {localPath}')#line:82
|
| 57 |
+
get_ipython ().system (f'ln -s {O000O00OOOOO000O0} {localPath}')#line:84
|
| 58 |
+
def initCloudDrive ():#line:87
|
| 59 |
+
cloudDriveSync (f'{gwb}')#line:88
|
| 60 |
+
cloudDriveSync (f'{gwb}/Config')#line:89
|
| 61 |
+
cloudDriveSync (f'{gwb}/Models',f'{wb}/models/{sd}',Drive_Map )#line:90
|
| 62 |
+
cloudDriveSync (f'{gwb}/Lora',f'{wb}/models/Lora',Drive_Map )#line:91
|
| 63 |
+
cloudDriveSync (f'{gwb}/LyCORIS',f'{wb}/models/LyCORIS',Drive_Map )#line:92
|
| 64 |
+
cloudDriveSync (f'{gwb}/Vae',f'{wb}/models/VAE',Drive_Map )#line:94
|
| 65 |
+
cloudDriveSync (f'{gwb}/Outputs',f'{wb}/outputs',Drive_Map )#line:95
|
| 66 |
+
if not os .path .exists (f'{gwb}/Config/config.json'):#line:99
|
| 67 |
+
get_ipython ().system (f'wget -O {gwb}/Config/config.json "https://huggingface.co/gmk123/colab/raw/main/config.json"')#line:100
|
| 68 |
+
if not os .path .exists (f'{gwb}/styles.csv'):#line:102
|
| 69 |
+
get_ipython ().system (f'wget -O {gwb}/styles.csv "https://huggingface.co/gmk123/colab/raw/main/styles.csv"')#line:104
|
| 70 |
+
def gitDownload (O00OOO0OO0OO0OOOO ,OOO00O0O0OO0OOOOO ):#line:107
|
| 71 |
+
if os .path .exists (OOO00O0O0OO0OOOOO ):#line:108
|
| 72 |
+
return #line:109
|
| 73 |
+
get_ipython ().system (f'git clone {O00OOO0OO0OO0OOOO} {OOO00O0O0OO0OOOOO}')#line:111
|
| 74 |
+
def installAdditional ():#line:114
|
| 75 |
+
O0000O0O00000OOO0 =[f'https://github.com/camenduru/{sdw}-images-browser',f'https://github.com/camenduru/sd-{w}-tunnels',f'https://github.com/etherealxx/batchlinks-{w}',f'https://github.com/camenduru/sd-civitai-browser',f'https://github.com/AUTOMATIC1111/{sdw}-rembg',f'https://github.com/thomasasfk/sd-{w}-aspect-ratio-helper',f'https://github.com/hanamizuki-ai/{sdw}-localization-zh_Hans',f'https://github.com/kohya-ss/sd-{w}-additional-networks',f'https://github.com/fkunn1326/openpose-editor',f'https://github.com/hnmr293/posex',f'https://github.com/s9roll7/ebsynth_utility',f'https://github.com/ashen-sensored/{sdw}-two-shot',f'https://github.com/nonnonstop/sd-{w}-3d-open-pose-editor',f'https://github.com/camenduru/{sdw}-huggingface',f'https://github.com/camenduru/{sdw}-catppuccin',f'https://github.com/IDEA-Research/DWPose',f'https://github.com/KohakuBlueleaf/a1111-sd-{w}-lycoris',f'https://github.com/Physton/sd-{w}-prompt-all-in-one',]#line:147
|
| 76 |
+
for O0OO0000OO00O00OO in O0000O0O00000OOO0 :#line:148
|
| 77 |
+
OOO00OOO00OO0OO00 =O0OO0000OO00O00OO .split ('/')[-1 ]#line:150
|
| 78 |
+
if 'github'in O0OO0000OO00O00OO :#line:152
|
| 79 |
+
get_ipython ().system (f'git clone {O0OO0000OO00O00OO} {wb}/extensions/{OOO00OOO00OO0OO00}')#line:153
|
| 80 |
+
get_ipython ().system (f'wget https://raw.githubusercontent.com/camenduru/{sdw}-scripts/main/run_n_times.py -O {wb}/scripts/run_n_times.py')#line:155
|
| 81 |
+
get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/embed/upscale/resolve/main/4x-UltraSharp.pth -d {wb}/models/ESRGAN -o 4x-UltraSharp.pth')#line:156
|
| 82 |
+
get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth -d {wb}/models/ESRGAN -o RealESRGAN_x4plus_anime_6B.pth')#line:157
|
| 83 |
+
gitDownload (f'https://huggingface.co/embed/negative',f'{wb}/embeddings/negative')#line:163
|
| 84 |
+
get_ipython ().system (f'rm -rf {wb}/embeddings/negative/.git')#line:164
|
| 85 |
+
get_ipython ().system (f'rm {wb}/embeddings/negative/.gitattributes')#line:165
|
| 86 |
+
gitDownload (f'https://huggingface.co/embed/lora',f'{wb}/models/Lora/positive')#line:167
|
| 87 |
+
get_ipython ().system (f'rm -rf {wb}/models/Lora/positive/.git')#line:168
|
| 88 |
+
get_ipython ().system (f'rm {wb}/models/Lora/positive/.gitattributes')#line:169
|
| 89 |
+
gitDownload (f'https://github.com/DominikDoom/a1111-sd-{w}-tagcomplete',f'{wb}/extensions/a1111-sd-{w}-tagcomplete')#line:172
|
| 90 |
+
get_ipython ().system (f'rm -f {wb}/extensions/a1111-sd-{w}-tagcomplete/tags/danbooru.csv')#line:173
|
| 91 |
+
get_ipython ().system (f'wget https://beehomefile.oss-cn-beijing.aliyuncs.com/20210114/danbooru.csv -O {wb}/extensions/a1111-sd-{w}-tagcomplete/tags/danbooru.csv')#line:174
|
| 92 |
+
gitDownload (f'https://github.com/toriato/{sdw}-wd14-tagger',f'{wb}/extensions/{sdw}-wd14-tagge')#line:175
|
| 93 |
+
gitDownload (f'https://github.com/Bing-su/adetailer',f'{wb}/extensions/adetailer')#line:179
|
| 94 |
+
gitDownload (f'https://github.com/antfu/sd-{w}-qrcode-toolkit',f'{wb}/extensions/sd-{w}-qrcode-toolkit')#line:180
|
| 95 |
+
gitDownload (f'https://github.com/yankooliveira/sd-{w}-photopea-embed',f'{wb}/extensions/sd-{w}-photopea-embed')#line:181
|
| 96 |
+
gitDownload (f'https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111',f'{wb}/extensions/multidiffusion-upscaler-for-automatic1111')#line:183
|
| 97 |
+
if Roop :#line:185
|
| 98 |
+
gitDownload (f'https://github.com/Gourieff/sd-{w}-reactor',f'{wb}/extensions/sd-{w}-reactor')#line:187
|
| 99 |
+
print ('Roop换脸启用')#line:189
|
| 100 |
+
else :#line:190
|
| 101 |
+
print ('Roop换脸不启用')#line:191
|
| 102 |
+
O0000O00000OO00OO =['control_v11e_sd15_ip2p.pth','control_v11e_sd15_shuffle.pth','control_v11f1e_sd15_tile.pth','control_v11f1p_sd15_depth.pth','control_v11p_sd15_canny.pth','control_v11p_sd15_inpaint.pth','control_v11p_sd15_lineart.pth','control_v11p_sd15_mlsd.pth','control_v11p_sd15_normalbae.pth','control_v11p_sd15_openpose.pth','control_v11p_sd15_scribble.pth','control_v11p_sd15_seg.pth','control_v11p_sd15_softedge.pth','control_v11p_sd15s2_lineart_anime.pth',]#line:209
|
| 103 |
+
get_ipython ().system (f'rm -rf {wb}/extensions/sd-{w}-controlnet')#line:210
|
| 104 |
+
if ControlNet =="Colab":#line:212
|
| 105 |
+
gitDownload (f'https://github.com/Mikubill/sd-{w}-controlnet',f'{wb}/extensions/sd-{w}-controlnet')#line:213
|
| 106 |
+
for O0O00000O0OO00O0O in O0000O00000OO00OO :#line:214
|
| 107 |
+
get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/{O0O00000O0OO00O0O} -d {wb}/extensions/sd-{w}-controlnet/models -o {O0O00000O0OO00O0O}')#line:215
|
| 108 |
+
elif ControlNet =="Google_Drive":#line:218
|
| 109 |
+
cloudDriveSync (f'{gwb}/CntModels')#line:219
|
| 110 |
+
gitDownload (f'https://github.com/Mikubill/sd-{w}-controlnet',f'{wb}/extensions/sd-{w}-controlnet')#line:220
|
| 111 |
+
for O0O00000O0OO00O0O in O0000O00000OO00OO :#line:221
|
| 112 |
+
if not os .path .exists (f'{gwb}/CntModels/{O0O00000O0OO00O0O}'):#line:222
|
| 113 |
+
get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/{O0O00000O0OO00O0O} -d {gwb}/CntModels -o {O0O00000O0OO00O0O}')#line:223
|
| 114 |
+
print ("创建扩展",f'{O0O00000O0OO00O0O}')#line:224
|
| 115 |
+
else :#line:225
|
| 116 |
+
print ("扩展存在",f'{O0O00000O0OO00O0O}')#line:226
|
| 117 |
+
for O0O00000O0OO00O0O in os .listdir (f'{gwb}/CntModels'):#line:228
|
| 118 |
+
get_ipython ().system (f'ln -s {gwb}/CntModels/{O0O00000O0OO00O0O} {wb}/extensions/sd-{w}-controlnet/models')#line:230
|
| 119 |
+
elif ControlNet =="No":#line:232
|
| 120 |
+
print ("不使用 ControlNet")#line:233
|
| 121 |
+
if UI =="Kitchen_Ui":#line:236
|
| 122 |
+
gitDownload (f'https://github.com/canisminor1990/sd-{w}-kitchen-theme-legacy',f'{wb}/extensions/sd-{w}-kitchen-theme-legacy')#line:237
|
| 123 |
+
print ("Kitchen界面插件启用")#line:238
|
| 124 |
+
elif UI =="Lobe_Ui":#line:239
|
| 125 |
+
gitDownload (f'https://github.com/canisminor1990/sd-web-ui-kitchen-theme',f'{wb}/extensions/sd-web-ui-kitchen-theme')#line:240
|
| 126 |
+
print ("Lobe界面插件启用")#line:241
|
| 127 |
+
elif UI =="No":#line:242
|
| 128 |
+
print ("UI插件不启用")#line:243
|
| 129 |
+
if Key_words :#line:246
|
| 130 |
+
cloudDriveSync (f'{gwb}/Storage',f'{wb}/extensions/sd-{w}-prompt-all-in-one/storage',Drive_Map )#line:247
|
| 131 |
+
print ("关键词插件启用")#line:248
|
| 132 |
+
else :#line:249
|
| 133 |
+
get_ipython ().system (f'rm -rf {wb}/extensions/sd-{w}-prompt-all-in-one')#line:250
|
| 134 |
+
print ("关键词插件不启用")#line:251
|
| 135 |
+
if SadTalker :#line:254
|
| 136 |
+
if not os .path .exists (f'{wb}/extensions/SadTalker'):#line:255
|
| 137 |
+
get_ipython ().system (f'git clone https://github.com/OpenTalker/SadTalker {wb}/extensions/SadTalker')#line:256
|
| 138 |
+
get_ipython ().system (f'git -C {wb}/extensions/SadTalker clone https://huggingface.co/gmk123/checkpoints')#line:257
|
| 139 |
+
get_ipython ().system (f'git -C {wb}/models clone https://huggingface.co/gmk123/GFPGAN')#line:258
|
| 140 |
+
get_ipython ().system (f'git clone https://github.com/numz/sd-wav2lip-uhq {wb}/extensions/sd-wav2lip-uhq')#line:260
|
| 141 |
+
get_ipython ().system (f'wget https://huggingface.co/gmk123/wav2lip/resolve/main/wav2lip.pth -O {wb}/extensions/sd-wav2lip-uhq/scripts/wav2lip/checkpoints/wav2lip.pth')#line:261
|
| 142 |
+
get_ipython ().system (f'wget https://huggingface.co/gmk123/wav2lip/resolve/main/wav2lip_gan.pth -O {wb}/extensions/sd-wav2lip-uhq/scripts/wav2lip/checkpoints/wav2lip_gan.pth')#line:262
|
| 143 |
+
get_ipython ().system (f'wget https://huggingface.co/gmk123/wav2lip/resolve/main/s3fd-619a316812.pth -O {wb}/extensions/sd-wav2lip-uhq/scripts/wav2lip/face_detection/detection/sfd/s3fd-619a316812.pth')#line:263
|
| 144 |
+
get_ipython ().system (f'wget https://huggingface.co/gmk123/wav2lip/resolve/main/shape_predictor_68_face_landmarks.dat -O {wb}/extensions/sd-wav2lip-uhq/scripts/wav2lip/predicator/shape_predictor_68_face_landmarks.dat')#line:264
|
| 145 |
+
get_ipython ().system (f'wget https://huggingface.co/ezioruan/inswapper_128.onnx/resolve/main/inswapper_128.onnx -O {wb}/extensions/sd-wav2lip-uhq/scripts/faceswap/model/inswapper_128.onnx')#line:265
|
| 146 |
+
print ("SadTalker启用")#line:267
|
| 147 |
+
else :#line:268
|
| 148 |
+
get_ipython ().system (f'rm -rf {wb}/extensions/SadTalker')#line:269
|
| 149 |
+
print ("SadTalker不启用")#line:270
|
| 150 |
+
if Segment_Anything :#line:273
|
| 151 |
+
get_ipython ().system (f'git clone https://github.com/continue-revolution/sd-{w}-segment-anything {wb}/extensions/sd-{w}-segment-anything')#line:274
|
| 152 |
+
get_ipython ().system (f'wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_l_0b3195.pth -O {wb}/extensions/sd-{w}-segment-anything/models/sam/sam_vit_l_0b3195.pth')#line:277
|
| 153 |
+
get_ipython ().system (f'wget https://huggingface.co/ShilongLiu/GroundingDINO/resolve/main/groundingdino_swinb_cogcoor.pth -O {wb}/extensions/sd-{w}-segment-anything/models/grounding-dino/groundingdino_swinb_cogcoor.pth')#line:278
|
| 154 |
+
print ("智能抠图插件启用")#line:290
|
| 155 |
+
else :#line:291
|
| 156 |
+
get_ipython ().system (f'rm -rf {wb}/extensions/sd-{w}-segment-anything')#line:292
|
| 157 |
+
print ("智能抠图插件不启用")#line:293
|
| 158 |
+
def initLocal ():#line:296
|
| 159 |
+
get_ipython ().system (f'apt -y update -qq')#line:298
|
| 160 |
+
get_ipython ().system (f'wget https://huggingface.co/gmk123/colab/resolve/main/libtcmalloc_minimal.so.4 -O /content/libtcmalloc_minimal.so.4')#line:299
|
| 161 |
+
get_ipython ().run_line_magic ('env',f'LD_PRELOAD=/content/libtcmalloc_minimal.so.4')#line:300
|
| 162 |
+
get_ipython ().system (f'apt -y install -qq aria2 libcairo2-dev pkg-config python3-dev')#line:303
|
| 163 |
+
get_ipython ().system (f'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')#line:304
|
| 164 |
+
get_ipython ().system (f'pip install -q xformers==0.0.20 triton==2.0.0 -U')#line:305
|
| 165 |
+
if Version =="A1111":#line:308
|
| 166 |
+
get_ipython ().system (f'git clone -b v2.5 https://github.com/camenduru/{sdw} {wb}')#line:309
|
| 167 |
+
elif Version =="V2.5":#line:310
|
| 168 |
+
get_ipython ().system (f'git clone -b v2.5 https://github.com/camenduru/{sdw} {wb}')#line:311
|
| 169 |
+
elif Version =="V2.4":#line:312
|
| 170 |
+
get_ipython ().system (f'git clone -b v2.4 https://github.com/camenduru/{sdw} {wb}')#line:313
|
| 171 |
+
get_ipython ().system (f'git -C {wb}/repositories/{sai} reset --hard')#line:315
|
| 172 |
+
initCloudDrive ()#line:318
|
| 173 |
+
installAdditional ()#line:321
|
| 174 |
+
get_ipython ().system (f'rm -f {wb}/config.json')#line:324
|
| 175 |
+
get_ipython ().system (f'ln -s {gwb}/Config/config.json {wb}/config.json')#line:327
|
| 176 |
+
if os .path .exists (f"{gwb}/styles.csv"):#line:330
|
| 177 |
+
get_ipython ().system (f'ln -s {gwb}/styles.csv {wb}/styles.csv')#line:331
|
| 178 |
+
if os .path .exists (f"{wb}/extensions/sd-{w}-additional-networks"):#line:334
|
| 179 |
+
cloudDriveSync (f'{gwb}/Lora',f'{wb}/extensions/sd-{w}-additional-networks/models/lora',Drive_Map )#line:335
|
| 180 |
+
if len (os .listdir (f"{gwb}/Models"))==0 :#line:338
|
| 181 |
+
get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/chilloutmix/resolve/main/chilloutmix_NiPrunedFp32Fix.safetensors -d {wb}/models/{sd} -o chilloutmix_NiPrunedFp32Fix.safetensors')#line:340
|
| 182 |
+
if len (os .listdir (f"{gwb}/Vae"))==0 :#line:343
|
| 183 |
+
get_ipython ().system (f'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 -d {wb}/models/VAE -o vae-ft-mse-840000-ema-pruned.safetensors')#line:345
|
| 184 |
+
get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/embed/upscale/resolve/main/4x-UltraSharp.pth -d {wb}/models/ESRGAN -o 4x-UltraSharp.pth')#line:348
|
| 185 |
+
O00O0000O00OO00OO =os .path .join (wb ,"models",sd )#line:350
|
| 186 |
+
if any (O0O0OOOOOO0OO0O00 .endswith (('.ckpt','.safetensors'))for O0O0OOOOOO0OO0O00 in os .listdir (O00O0000O00OO00OO )):#line:351
|
| 187 |
+
get_ipython ().system (f'sed -i \'s@weight_load_location =.*@weight_load_location = "cuda"@\' {wb}/modules/shared.py')#line:352
|
| 188 |
+
get_ipython ().system (f'sed -i "s@os.path.splitext(model_file)@os.path.splitext(model_file); map_location=\'cuda\'@" {wb}/modules/sd_models.py')#line:353
|
| 189 |
+
get_ipython ().system (f'sed -i "s@map_location=\'cpu\'@map_location=\'cuda\'@" {wb}/modules/extras.py')#line:354
|
| 190 |
+
get_ipython ().system (f"sed -i 's@ui.create_ui().*@ui.create_ui();shared.demo.queue(concurrency_count=999999,status_update_rate=0.1)@' {wb}/{w}.py")#line:355
|
| 191 |
+
def run (O0000OOO000OOOOOO ):#line:358
|
| 192 |
+
clear_output ()#line:359
|
| 193 |
+
get_ipython ().run_line_magic ('cd',f'{wb}')#line:360
|
| 194 |
+
get_ipython ().system (f'python {O0000OOO000OOOOOO} --ngrok 2VYRSQJASKBEo5BkP4YZIU7fWVN_3xoNLnayrYf2tFZTBiWXU --api --disable-safe-unpickle --enable-insecure-extension-access --no-download-sd-model --no-half-vae --xformers --disable-console-progressbars --theme dark --cors-allow-origins=*')#line:361
|
| 195 |
+
if os .path .exists (f'{wb}'):#line:364
|
| 196 |
+
run (f'{w}.py')#line:365
|
| 197 |
+
else :#line:366
|
| 198 |
+
initLocal ()#line:368
|
| 199 |
+
run (f'{l}.py')
|