gmk123 commited on
Commit
ebb2d77
·
verified ·
1 Parent(s): c35046c

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +86 -84
run.py CHANGED
@@ -1,13 +1,13 @@
1
  import argparse #line:1
2
  import binascii #line:2
3
  import ipywidgets as widgets #line:3
4
- def str_to_bool (OO00OO0000OOOO00O ):#line:7
5
- if OO00OO0000OOOO00O .lower ()in ('yes','true','t','y','1'):#line:8
6
  return True #line:9
7
- elif OO00OO0000OOOO00O .lower ()in ('no','false','f','n','0'):#line:10
8
  return False #line:11
9
  else :#line:12
10
- raise argparse .ArgumentTypeError ('Invalid boolean value: {}'.format (OO00OO0000OOOO00O ))#line:13
11
  parser =argparse .ArgumentParser ()#line:16
12
  parser .add_argument ('--Animatediff',type =str_to_bool )#line:18
13
  parser .add_argument ('--ControlNet',type =str )#line:19
@@ -46,13 +46,13 @@ wb =f'/root/main'#line:63
46
  sai =base64 .b64decode (("c3RhYmxlLWRpZmZ1c2lvbi1zdGFiaWxpdHktYWk=").encode ('ascii')).decode ('ascii')#line:64
47
  sd =base64 .b64decode (("U3RhYmxlLWRpZmZ1c2lvbg==").encode ('ascii')).decode ('ascii')#line:65
48
  gwb =f'/content/drive/MyDrive/SD_DATA'#line:66
49
- def cloudDriveSync (O00O00O0OO000O0O0 ,OO0000OOOO0000000 ='',OO00O00OOO00OO0O0 =False ):#line:70
50
- if not os .path .exists (O00O00O0OO000O0O0 ):#line:72
51
- get_ipython ().system (f'mkdir {O00O00O0OO000O0O0}')#line:74
52
- if not OO00O00OOO00OO0O0 :#line:77
53
  return #line:78
54
- get_ipython ().system (f'rm -rf {OO0000OOOO0000000}')#line:81
55
- get_ipython ().system (f'ln -s {O00O00O0OO000O0O0} {OO0000OOOO0000000}')#line:83
56
  def initCloudDrive ():#line:86
57
  cloudDriveSync (f'{gwb}')#line:87
58
  cloudDriveSync (f'{gwb}/Config')#line:88
@@ -66,16 +66,16 @@ def initCloudDrive ():#line:86
66
  get_ipython ().system (f'wget -O {gwb}/Config/config.json "https://huggingface.co/gmk123/colab/raw/main/config.json"')#line:99
67
  if not os .path .exists (f'{gwb}/styles.csv'):#line:101
68
  get_ipython ().system (f'wget -O {gwb}/styles.csv "https://huggingface.co/gmk123/colab/raw/main/styles.csv"')#line:103
69
- def gitDownload (OO0000O00OO0000O0 ,O00OO0000O00O0O0O ):#line:106
70
- if os .path .exists (O00OO0000O00O0O0O ):#line:107
71
  return #line:108
72
- get_ipython ().system (f'git clone {OO0000O00OO0000O0} {O00OO0000O00O0O0O}')#line:110
73
  def installAdditional ():#line:113
74
- OOO00O0OO0000O00O =[f'https://github.com/AlUlkesh/{sdw}-images-browser',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/nonnonstop/sd-{w}-3d-open-pose-editor',f'https://github.com/IDEA-Research/DWPose',f'https://github.com/Physton/sd-{w}-prompt-all-in-one',f'https://github.com/adieyal/sd-dynamic-prompts',f'https://github.com/Bing-su/adetailer',f'https://github.com/Tencent/LightDiffusionFlow',f'https://github.com/picobyte/{sdw}-wd14-tagger',f'https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111',]#line:152
75
- for O0OO0OO0O00OOO00O in OOO00O0OO0000O00O :#line:153
76
- O0OOO00000OOOOOOO =O0OO0OO0O00OOO00O .split ('/')[-1 ]#line:155
77
- if 'github'in O0OO0OO0O00OOO00O :#line:157
78
- get_ipython ().system (f'git clone {O0OO0OO0O00OOO00O} {wb}/extensions/{O0OOO00000OOOOOOO}')#line:158
79
  cloudDriveSync (f'{gwb}/prompts',f'{wb}/extensions/sd-dynamic-prompts/wildcards',Drive_Map )#line:160
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:161
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:162
@@ -102,23 +102,23 @@ def installAdditional ():#line:113
102
  print ('Roop换脸启用')#line:193
103
  else :#line:194
104
  print ('Roop换脸不启用')#line:195
105
- O00O00OOOOO00OO0O =['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:213
106
  get_ipython ().system (f'rm -rf {wb}/extensions/sd-{w}-controlnet')#line:214
107
  if ControlNet =="Colab":#line:216
108
  gitDownload (f'https://github.com/Mikubill/sd-{w}-controlnet',f'{wb}/extensions/sd-{w}-controlnet')#line:217
109
- for O0OOOOOOO0OO0OOO0 in O00O00OOOOO00OO0O :#line:218
110
- 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/{O0OOOOOOO0OO0OOO0} -d {wb}/extensions/sd-{w}-controlnet/models -o {v}')#line:219
111
  elif ControlNet =="Google_Drive":#line:222
112
  cloudDriveSync (f'{gwb}/CntModels')#line:223
113
  gitDownload (f'https://github.com/Mikubill/sd-{w}-controlnet',f'{wb}/extensions/sd-{w}-controlnet')#line:224
114
- for O0OOOOOOO0OO0OOO0 in O00O00OOOOO00OO0O :#line:225
115
- if not os .path .exists (f'{gwb}/CntModels/{O0OOOOOOO0OO0OOO0}'):#line:226
116
- 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/{O0OOOOOOO0OO0OOO0} -d {gwb}/CntModels -o {v}')#line:227
117
- print ("创建扩展",f'{O0OOOOOOO0OO0OOO0}')#line:228
118
  else :#line:229
119
- print ("扩展存在",f'{O0OOOOOOO0OO0OOO0}')#line:230
120
- for O0OOOOOOO0OO0OOO0 in os .listdir (f'{gwb}/CntModels'):#line:232
121
- get_ipython ().system (f'ln -s {gwb}/CntModels/{O0OOOOOOO0OO0OOO0} {wb}/extensions/sd-{w}-controlnet/models')#line:234
122
  elif ControlNet =="No":#line:236
123
  print ("不使用 ControlNet")#line:237
124
  if Animatediff :#line:240
@@ -162,60 +162,62 @@ def installAdditional ():#line:113
162
  def initLocal ():#line:297
163
  get_ipython ().system ('apt -y install -qq aria2 git')#line:299
164
  get_ipython ().system (f'pip install lmdb')#line:301
165
- get_ipython ().system (f'pip install torch==2.1.2+cu121 torchvision==0.16.2+cu121 torchaudio==2.1.2 --extra-index-url https://download.pytorch.org/whl/cu121')#line:303
166
- get_ipython ().system (f'pip install xformers==0.0.23.post1')#line:304
167
- get_ipython ().run_line_magic ('cd','/content')#line:305
168
- with capture .capture_output ()as O0O0000O0O0OO0OOO :#line:307
169
- def OOOO000OOOOOOO000 (OOOOOO00OO00O0000 ,O000O00O0000O0000 ,OO000O0OO0OOOO0O0 ):O0O00O0OOO0OO0OOO =widgets .Button (description =OOOOOO00OO00O0000 ,disabled =True ,button_style =O000O00O0000O0000 ,layout =widgets .Layout (min_width =OO000O0OO0OOOO0O0 ));display (O0O00O0OOO0OO0OOO )#line:308
170
- get_ipython ().system (f'git clone -q --branch master https://github.com/AUTOMATIC1111/{sdw} /root/main')#line:310
171
- get_ipython ().system (f'pip install -q basicsr')#line:312
172
- with capture .capture_output ()as O0O0000O0O0OO0OOO :#line:314
173
- get_ipython ().run_line_magic ('cd','/content')#line:315
174
- get_ipython ().system (f'mkdir -p {wb}/repositories/{sai}')#line:317
175
- get_ipython ().system ('wget -q -i https://huggingface.co/gmk123/run/raw/main/A1111.txt')#line:318
176
- get_ipython ().system ('dpkg -i *.deb')#line:319
177
- get_ipython ().system ('tar -C /content/ --zstd -xf sd_mrep.tar.zst')#line:320
178
- get_ipython ().system ('tar -C / --zstd -xf gcolabdeps.tar.zst')#line:321
179
- get_ipython ().system ('rm *.deb | rm *.zst | rm *.txt')#line:322
180
- get_ipython ().system (f'mv -n /content/sd/stablediffusion/* {wb}/repositories/{sai} && rm -rf /content/sd')#line:323
181
- os .environ ['TF_CPP_MIN_LOG_LEVEL']='3'#line:324
182
- os .environ ['PYTHONWARNINGS']='ignore'#line:325
183
- get_ipython ().system ('sed -i \'s@text = _formatwarnmsg(msg)@text =\"\"@g\' /usr/lib/python3.10/warnings.py')#line:326
184
- get_ipython ().system ('apt --fix-broken install')#line:328
185
- get_ipython ().system (f'pip install --force-reinstall charset-normalizer==3.1.0')#line:329
186
- get_ipython ().system (f'pip install -qq translators chardet openai boto3 aliyun-python-sdk-core aliyun-python-sdk-alimt python-dotenv image-reward pyfunctional')#line:330
187
- get_ipython ().system (f'pip install -U dynamicprompts[attentiongrabber,magicprompt]')#line:332
188
- get_ipython ().system (f'git -C {wb}/repositories/{sai} reset --hard')#line:334
189
- initCloudDrive ()#line:339
190
- installAdditional ()#line:342
191
- clear_output ()#line:344
192
- get_ipython ().system (f'rm -f {wb}/config.json')#line:346
193
- get_ipython ().system (f'ln -s {gwb}/Config/config.json {wb}/config.json')#line:347
194
- if os .path .exists (f"{gwb}/styles.csv"):#line:350
195
- get_ipython ().system (f'ln -s {gwb}/styles.csv {wb}/styles.csv')#line:351
196
- if os .path .exists (f"{wb}/extensions/sd-{w}-additional-networks"):#line:354
197
- cloudDriveSync (f'{gwb}/Lora',f'{wb}/extensions/sd-{w}-additional-networks/models/lora',Drive_Map )#line:355
198
- if len (os .listdir (f"{gwb}/Models"))==0 :#line:358
199
- 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:360
200
- if len (os .listdir (f"{gwb}/Vae"))==0 :#line:363
201
- 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:365
202
- 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:368
203
- get_ipython ().run_line_magic ('cd',f'{wb}/modules')#line:372
204
- get_ipython ().system ('wget -q -O extras.py https://huggingface.co/gmk123/run/raw/main/extras.py')#line:373
205
- get_ipython ().system ('wget -q -O sd_models.py https://huggingface.co/gmk123/run/raw/main/sd_models.py')#line:374
206
- get_ipython ().system ('wget -q -O /usr/local/lib/python3.10/dist-packages/gradio/blocks.py https://huggingface.co/gmk123/run/raw/main/blocks.py')#line:375
207
- get_ipython ().run_line_magic ('cd',f'{wb}')#line:377
208
- get_ipython ().system (f'sed -i \'s@print(\\"No module.*@@\' {wb}/repositories/{sai}/ldm/modules/diffusionmodules/model.py')#line:378
209
- get_ipython ().system (f'sed -i \'s@\\["sd_model_checkpoint"\\]@\\["sd_model_checkpoint", "sd_vae", "CLIP_stop_at_last_layers", "inpainting_mask_weight", "initial_noise_multiplier"\\]@g\' {wb}/modules/shared.py')#line:379
210
- get_ipython ().system (f'sed -i \'s@possible_sd_paths =.*@possible_sd_paths = [\"{wb}/repositories/{sai}\"]@\' {wb}/modules/paths.py')#line:381
211
- get_ipython ().system (f'sed -i \'s@\\.\\.\\/@src/@g\' {wb}/modules/paths.py')#line:382
212
- get_ipython ().system (f'sed -i \'s@src/generative-models@generative-models@g\' {wb}/modules/paths.py')#line:383
213
- def run (OOOOO0O0O00O000O0 ):#line:387
214
- clear_output ()#line:388
215
- get_ipython ().run_line_magic ('cd',f'{wb}')#line:389
216
- get_ipython ().system (f'python {OOOOO0O0O00O000O0} --share --api --disable-safe-unpickle --enable-insecure-extension-access --xformers --disable-console-progressbars --theme dark --upcast-sampling --cors-allow-origins=*')#line:390
217
- if os .path .exists (f'{wb}'):#line:393
218
- run (f'{w}.py')#line:394
219
- else :#line:395
220
- initLocal ()#line:397
 
 
221
  run (f'{w}.py')
 
1
  import argparse #line:1
2
  import binascii #line:2
3
  import ipywidgets as widgets #line:3
4
+ def str_to_bool (O0OOOO0O00O0OOO0O ):#line:7
5
+ if O0OOOO0O00O0OOO0O .lower ()in ('yes','true','t','y','1'):#line:8
6
  return True #line:9
7
+ elif O0OOOO0O00O0OOO0O .lower ()in ('no','false','f','n','0'):#line:10
8
  return False #line:11
9
  else :#line:12
10
+ raise argparse .ArgumentTypeError ('Invalid boolean value: {}'.format (O0OOOO0O00O0OOO0O ))#line:13
11
  parser =argparse .ArgumentParser ()#line:16
12
  parser .add_argument ('--Animatediff',type =str_to_bool )#line:18
13
  parser .add_argument ('--ControlNet',type =str )#line:19
 
46
  sai =base64 .b64decode (("c3RhYmxlLWRpZmZ1c2lvbi1zdGFiaWxpdHktYWk=").encode ('ascii')).decode ('ascii')#line:64
47
  sd =base64 .b64decode (("U3RhYmxlLWRpZmZ1c2lvbg==").encode ('ascii')).decode ('ascii')#line:65
48
  gwb =f'/content/drive/MyDrive/SD_DATA'#line:66
49
+ def cloudDriveSync (O00O00O0OOO0OOO00 ,OOO0000O00O0OO0O0 ='',OOO0000O0O0O00OOO =False ):#line:70
50
+ if not os .path .exists (O00O00O0OOO0OOO00 ):#line:72
51
+ get_ipython ().system (f'mkdir {O00O00O0OOO0OOO00}')#line:74
52
+ if not OOO0000O0O0O00OOO :#line:77
53
  return #line:78
54
+ get_ipython ().system (f'rm -rf {OOO0000O00O0OO0O0}')#line:81
55
+ get_ipython ().system (f'ln -s {O00O00O0OOO0OOO00} {OOO0000O00O0OO0O0}')#line:83
56
  def initCloudDrive ():#line:86
57
  cloudDriveSync (f'{gwb}')#line:87
58
  cloudDriveSync (f'{gwb}/Config')#line:88
 
66
  get_ipython ().system (f'wget -O {gwb}/Config/config.json "https://huggingface.co/gmk123/colab/raw/main/config.json"')#line:99
67
  if not os .path .exists (f'{gwb}/styles.csv'):#line:101
68
  get_ipython ().system (f'wget -O {gwb}/styles.csv "https://huggingface.co/gmk123/colab/raw/main/styles.csv"')#line:103
69
+ def gitDownload (O00O00O0OO0O00000 ,OOOOOOOOO0OOO0000 ):#line:106
70
+ if os .path .exists (OOOOOOOOO0OOO0000 ):#line:107
71
  return #line:108
72
+ get_ipython ().system (f'git clone {O00O00O0OO0O00000} {OOOOOOOOO0OOO0000}')#line:110
73
  def installAdditional ():#line:113
74
+ O00OOO0OOO0O00O00 =[f'https://github.com/AlUlkesh/{sdw}-images-browser',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/nonnonstop/sd-{w}-3d-open-pose-editor',f'https://github.com/IDEA-Research/DWPose',f'https://github.com/Physton/sd-{w}-prompt-all-in-one',f'https://github.com/adieyal/sd-dynamic-prompts',f'https://github.com/Bing-su/adetailer',f'https://github.com/Tencent/LightDiffusionFlow',f'https://github.com/picobyte/{sdw}-wd14-tagger',f'https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111',]#line:152
75
+ for O000OOOO000O0OOOO in O00OOO0OOO0O00O00 :#line:153
76
+ OO00OO0000O0O0000 =O000OOOO000O0OOOO .split ('/')[-1 ]#line:155
77
+ if 'github'in O000OOOO000O0OOOO :#line:157
78
+ get_ipython ().system (f'git clone {O000OOOO000O0OOOO} {wb}/extensions/{OO00OO0000O0O0000}')#line:158
79
  cloudDriveSync (f'{gwb}/prompts',f'{wb}/extensions/sd-dynamic-prompts/wildcards',Drive_Map )#line:160
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:161
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:162
 
102
  print ('Roop换脸启用')#line:193
103
  else :#line:194
104
  print ('Roop换脸不启用')#line:195
105
+ OO0000000O00000O0 =['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:213
106
  get_ipython ().system (f'rm -rf {wb}/extensions/sd-{w}-controlnet')#line:214
107
  if ControlNet =="Colab":#line:216
108
  gitDownload (f'https://github.com/Mikubill/sd-{w}-controlnet',f'{wb}/extensions/sd-{w}-controlnet')#line:217
109
+ for OOO0O00OO0OO0OOOO in OO0000000O00000O0 :#line:218
110
+ 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/{OOO0O00OO0OO0OOOO} -d {wb}/extensions/sd-{w}-controlnet/models -o {v}')#line:219
111
  elif ControlNet =="Google_Drive":#line:222
112
  cloudDriveSync (f'{gwb}/CntModels')#line:223
113
  gitDownload (f'https://github.com/Mikubill/sd-{w}-controlnet',f'{wb}/extensions/sd-{w}-controlnet')#line:224
114
+ for OOO0O00OO0OO0OOOO in OO0000000O00000O0 :#line:225
115
+ if not os .path .exists (f'{gwb}/CntModels/{OOO0O00OO0OO0OOOO}'):#line:226
116
+ 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/{OOO0O00OO0OO0OOOO} -d {gwb}/CntModels -o {v}')#line:227
117
+ print ("创建扩展",f'{OOO0O00OO0OO0OOOO}')#line:228
118
  else :#line:229
119
+ print ("扩展存在",f'{OOO0O00OO0OO0OOOO}')#line:230
120
+ for OOO0O00OO0OO0OOOO in os .listdir (f'{gwb}/CntModels'):#line:232
121
+ get_ipython ().system (f'ln -s {gwb}/CntModels/{OOO0O00OO0OO0OOOO} {wb}/extensions/sd-{w}-controlnet/models')#line:234
122
  elif ControlNet =="No":#line:236
123
  print ("不使用 ControlNet")#line:237
124
  if Animatediff :#line:240
 
162
  def initLocal ():#line:297
163
  get_ipython ().system ('apt -y install -qq aria2 git')#line:299
164
  get_ipython ().system (f'pip install lmdb')#line:301
165
+ get_ipython ().system (f'pip install torch==2.1.0+cu118 torchvision==0.16.0+cu118 torchaudio==2.1.0+cu118 torchtext==0.16.0+cpu torchdata==0.7.0 --index-url https://download.pytorch.org/whl/cu118')#line:303
166
+ get_ipython ().run_line_magic ('cd','/content')#line:304
167
+ get_ipython ().system (f'pip install -q basicsr')#line:305
168
+ with capture .capture_output ()as O0O0OO00OOO000OO0 :#line:307
169
+ get_ipython ().run_line_magic ('cd',f'{wb}')#line:308
170
+ get_ipython ().system ('pip install -q -r requirements.txt')#line:310
171
+ with capture .capture_output ()as O0O0OO00OOO000OO0 :#line:312
172
+ def O0000O00O00OO000O (OO0000O0O0000OOO0 ,OO0O0O0OOO0000O00 ,OOOO0OO0OOO0OO000 ):O00O00O000OOOO000 =widgets .Button (description =OO0000O0O0000OOO0 ,disabled =True ,button_style =OO0O0O0OOO0000O00 ,layout =widgets .Layout (min_width =OOOO0OO0OOO0OO000 ));display (O00O00O000OOOO000 )#line:313
173
+ get_ipython ().system (f'git clone -q --branch master https://github.com/AUTOMATIC1111/{sdw} /root/main')#line:315
174
+ with capture .capture_output ()as O0O0OO00OOO000OO0 :#line:317
175
+ get_ipython ().run_line_magic ('cd','/content')#line:318
176
+ get_ipython ().system (f'mkdir -p {wb}/repositories/{sai}')#line:320
177
+ get_ipython ().system ('wget -q -i https://huggingface.co/gmk123/run/raw/main/A1111.txt')#line:321
178
+ get_ipython ().system ('dpkg -i *.deb')#line:322
179
+ get_ipython ().system ('tar -C /content/ --zstd -xf sd_mrep.tar.zst')#line:323
180
+ get_ipython ().system ('tar -C / --zstd -xf gcolabdeps.tar.zst')#line:324
181
+ get_ipython ().system ('rm *.deb | rm *.zst | rm *.txt')#line:325
182
+ get_ipython ().system (f'mv -n /content/sd/stablediffusion/* {wb}/repositories/{sai} && rm -rf /content/sd')#line:326
183
+ os .environ ['TF_CPP_MIN_LOG_LEVEL']='3'#line:327
184
+ os .environ ['PYTHONWARNINGS']='ignore'#line:328
185
+ get_ipython ().system ('sed -i \'s@text = _formatwarnmsg(msg)@text =\"\"@g\' /usr/lib/python3.10/warnings.py')#line:329
186
+ get_ipython ().system ('apt --fix-broken install')#line:331
187
+ get_ipython ().system (f'pip install --force-reinstall charset-normalizer==3.1.0')#line:332
188
+ get_ipython ().system (f'pip install -qq translators chardet openai boto3 aliyun-python-sdk-core aliyun-python-sdk-alimt python-dotenv image-reward pyfunctional')#line:333
189
+ get_ipython ().system (f'pip install -U dynamicprompts[attentiongrabber,magicprompt]')#line:335
190
+ get_ipython ().system (f'git -C {wb}/repositories/{sai} reset --hard')#line:337
191
+ initCloudDrive ()#line:342
192
+ installAdditional ()#line:345
193
+ clear_output ()#line:347
194
+ get_ipython ().system (f'rm -f {wb}/config.json')#line:349
195
+ get_ipython ().system (f'ln -s {gwb}/Config/config.json {wb}/config.json')#line:350
196
+ if os .path .exists (f"{gwb}/styles.csv"):#line:353
197
+ get_ipython ().system (f'ln -s {gwb}/styles.csv {wb}/styles.csv')#line:354
198
+ if os .path .exists (f"{wb}/extensions/sd-{w}-additional-networks"):#line:357
199
+ cloudDriveSync (f'{gwb}/Lora',f'{wb}/extensions/sd-{w}-additional-networks/models/lora',Drive_Map )#line:358
200
+ if len (os .listdir (f"{gwb}/Models"))==0 :#line:361
201
+ 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:363
202
+ if len (os .listdir (f"{gwb}/Vae"))==0 :#line:366
203
+ 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:368
204
+ 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:371
205
+ get_ipython ().run_line_magic ('cd',f'{wb}/modules')#line:375
206
+ get_ipython ().system ('wget -q -O extras.py https://huggingface.co/gmk123/run/raw/main/extras.py')#line:376
207
+ get_ipython ().system ('wget -q -O sd_models.py https://huggingface.co/gmk123/run/raw/main/sd_models.py')#line:377
208
+ get_ipython ().system ('wget -q -O /usr/local/lib/python3.10/dist-packages/gradio/blocks.py https://huggingface.co/gmk123/run/raw/main/blocks.py')#line:378
209
+ get_ipython ().run_line_magic ('cd',f'{wb}')#line:380
210
+ get_ipython ().system (f'sed -i \'s@print(\\"No module.*@@\' {wb}/repositories/{sai}/ldm/modules/diffusionmodules/model.py')#line:381
211
+ get_ipython ().system (f'sed -i \'s@\\["sd_model_checkpoint"\\]@\\["sd_model_checkpoint", "sd_vae", "CLIP_stop_at_last_layers", "inpainting_mask_weight", "initial_noise_multiplier"\\]@g\' {wb}/modules/shared.py')#line:382
212
+ get_ipython ().system (f'sed -i \'s@possible_sd_paths =.*@possible_sd_paths = [\"{wb}/repositories/{sai}\"]@\' {wb}/modules/paths.py')#line:384
213
+ get_ipython ().system (f'sed -i \'s@\\.\\.\\/@src/@g\' {wb}/modules/paths.py')#line:385
214
+ get_ipython ().system (f'sed -i \'s@src/generative-models@generative-models@g\' {wb}/modules/paths.py')#line:386
215
+ def run (OO0OOO0OOO0O00000 ):#line:390
216
+ clear_output ()#line:391
217
+ get_ipython ().run_line_magic ('cd',f'{wb}')#line:392
218
+ get_ipython ().system (f'python {OO0OOO0OOO0O00000} --share --api --disable-safe-unpickle --enable-insecure-extension-access --xformers --disable-console-progressbars --theme dark --upcast-sampling --cors-allow-origins=*')#line:393
219
+ if os .path .exists (f'{wb}'):#line:396
220
+ run (f'{w}.py')#line:397
221
+ else :#line:398
222
+ initLocal ()#line:400
223
  run (f'{w}.py')