gmk123 commited on
Commit
7eb5fc0
·
verified ·
1 Parent(s): e22810c

Update sagemaker.py

Browse files
Files changed (1) hide show
  1. sagemaker.py +47 -48
sagemaker.py CHANGED
@@ -4,16 +4,16 @@ from IPython import get_ipython #line:3
4
  from IPython .utils import capture #line:4
5
  from IPython .display import clear_output #line:5
6
  wb =f'/home/studio-lab-user/stable-diffusion-webui'#line:8
7
- def gitDownload (OOOO0O00000OOO0O0 ,OOOO0O000OOOOOO00 ):#line:11
8
- if os .path .exists (OOOO0O000OOOOOO00 ):#line:12
9
  return #line:13
10
- get_ipython ().system (f'git clone {OOOO0O00000OOO0O0} {OOOO0O000OOOOOO00}')#line:15
11
  def installAdditional ():#line:18
12
- O000O0O0O0000OOO0 =[f'https://github.com/AlUlkesh/stable-diffusion-webui-images-browser',f'https://github.com/etherealxx/batchlinks-webui',f'https://github.com/camenduru/sd-civitai-browser',f'https://github.com/thomasasfk/sd-webui-aspect-ratio-helper',f'https://github.com/kohya-ss/sd-webui-additional-networks',f'https://github.com/fkunn1326/openpose-editor',f'https://github.com/nonnonstop/sd-webui-3d-open-pose-editor',f'https://github.com/Physton/sd-webui-prompt-all-in-one',f'https://github.com/Bing-su/adetailer',f'https://github.com/picobyte/stable-diffusion-webui-wd14-tagger',f'https://github.com/Mikubill/sd-webui-controlnet',f'https://github.com/IDEA-Research/DWPose',f'https://github.com/hanamizuki-ai/stable-diffusion-webui-localization-zh_Hans',f'https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111',]#line:58
13
- for O00OOOO000O00000O in O000O0O0O0000OOO0 :#line:59
14
- O0OOO0OOO0OOO0000 =O00OOOO000O00000O .split ('/')[-1 ]#line:61
15
- if 'github'in O00OOOO000O00000O :#line:63
16
- get_ipython ().system (f'git clone --depth 1 {O00OOOO000O00000O} {wb}/extensions/{O0OOO0OOO0OOO0000}')#line:64
17
  get_ipython ().system (f'wget https://raw.githubuserhome/studio-lab-user.com/camenduru/stable-diffusion-webui-scripts/main/run_n_times.py -O {wb}/scripts/run_n_times.py')#line:66
18
  gitDownload (f'https://huggingface.co/embed/negative',f'{wb}/embeddings/negative')#line:70
19
  get_ipython ().system (f'rm -rf {wb}/embeddings/negative/.git')#line:71
@@ -31,14 +31,14 @@ def installAdditional ():#line:18
31
  print ('Roop换脸启用')#line:88
32
  import subprocess #line:90
33
  def sync_tmp_folder ():#line:92
34
- OO00O000O0O0OOO00 =[['rm','-rf','~/tmp/*','~/tmp','~/stable-diffusion-webui/models/Stable-diffusion/tmp_models','~/stable-diffusion-webui/models/ControlNet'],['ln','-vs','/tmp','~/tmp'],['ln','-vs','/tmp/models','~/stable-diffusion-webui/models/Stable-diffusion/tmp_models'],['ln','-vs','/tmp/ControlNet','~/stable-diffusion-webui/models/ControlNet']]#line:98
35
- for O0O0000O0O00OO000 in OO00O000O0O0OOO00 :#line:100
36
- O00OOO000O0000OOO =[os .path .expanduser (OOOO0OOOO000000OO )for OOOO0OOOO000000OO in O0O0000O0O00OO000 ]#line:101
37
- subprocess .run (O00OOO000O0000OOO ,check =True )#line:102
38
- def run_command (OO000OOO00OOO0O0O ,O0OOOO000OOO0OOO0 ):#line:104
39
- print (f"Please wait, {O0OOOO000OOO0OOO0} is loading...")#line:105
40
- subprocess .run (OO000OOO00OOO0O0O ,shell =True ,stdout =subprocess .DEVNULL ,stderr =subprocess .DEVNULL )#line:106
41
- print (f"{O0OOOO000OOO0OOO0} ok!")#line:107
42
  def initLocal ():#line:110
43
  run_command ('conda install conda -y','Conda')#line:112
44
  run_command ('conda update -n base conda -y','Update')#line:114
@@ -47,35 +47,34 @@ def initLocal ():#line:110
47
  run_command ('pip install torch==2.1.0 torchvision==0.16.0 --extra-index-url https://download.pytorch.org/whl/cu121','【 Installing Torch 】')#line:118
48
  run_command ('pip install xformers==0.0.22.post7','【 Installing xformers 】')#line:119
49
  get_ipython ().system ('pip install -q aria2')#line:120
50
- get_ipython ().system ('pip install tqdm')#line:121
51
- clear_output ()#line:124
52
- get_ipython ().run_line_magic ('cd','/home/studio-lab-user')#line:125
53
- get_ipython ().system (f'git clone -q --branch master https://github.com/AUTOMATIC1111/stable-diffusion-webui {wb}')#line:128
54
- sync_tmp_folder ()#line:131
55
- clear_output ()#line:133
56
- get_ipython ().system (f'pip install -q basicsr')#line:138
57
- get_ipython ().system (f'pip install -q fake_useragent')#line:139
58
- installAdditional ()#line:144
59
- get_ipython ().system (f'rm -rf {wb}/config.json')#line:147
60
- get_ipython ().system (f'wget -O {wb}/config.json "https://huggingface.co/gmk123/colab/raw/main/config.json"')#line:148
61
- get_ipython ().system (f'wget -O {wb}/styles.csv "https://huggingface.co/gmk123/colab/raw/main/styles.csv"')#line:149
62
- clear_output ()#line:151
63
- get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/192916 -d {wb}/models/Stable-diffusion -o MoyouArtificial_v1060.safetensors')#line:153
64
- 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:155
65
- 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:157
66
- wise ="--listen --api --enable-insecure-extension-access --xformers --theme dark --gradio-queue --disable-console-progressbars --upcast-sampling --cors-allow-origins=*"#line:159
67
- ngrok_token =os .environ .get ('NGROK_TOKEN')#line:162
68
- wise +=f" --ngrok {ngrok_token}"#line:163
69
- def run (O000OOOO000OO00OO ):#line:166
70
- clear_output ()#line:167
71
- print (f'Ngrok内网令牌:{ngrok_token}')#line:168
72
- print (f'Ngrok注意事项:每个账号每月1G流量!!!请留意后台剩余流量。')#line:169
73
- print (f'Ngrok剩余流量:点击查看 -- https://dashboard.ngrok.com/usage')#line:170
74
- get_ipython ().system (f'mkdir -p /tmp/ControlNet')#line:171
75
- get_ipython ().run_line_magic ('cd',f'{wb}')#line:173
76
- get_ipython ().system (f'python {O000OOOO000OO00OO} {wise}')#line:174
77
- if os .path .exists (f'{wb}'):#line:177
78
- run (f'webui.py')#line:179
79
- else :#line:180
80
- initLocal ()#line:182
81
- run (f'launch.py')#line:185
 
4
  from IPython .utils import capture #line:4
5
  from IPython .display import clear_output #line:5
6
  wb =f'/home/studio-lab-user/stable-diffusion-webui'#line:8
7
+ def gitDownload (O000O0OO000OOOOOO ,OO0OO00000OOO000O ):#line:11
8
+ if os .path .exists (OO0OO00000OOO000O ):#line:12
9
  return #line:13
10
+ get_ipython ().system (f'git clone {O000O0OO000OOOOOO} {OO0OO00000OOO000O}')#line:15
11
  def installAdditional ():#line:18
12
+ O00OOOOOOOO0OOO0O =[f'https://github.com/AlUlkesh/stable-diffusion-webui-images-browser',f'https://github.com/etherealxx/batchlinks-webui',f'https://github.com/camenduru/sd-civitai-browser',f'https://github.com/thomasasfk/sd-webui-aspect-ratio-helper',f'https://github.com/kohya-ss/sd-webui-additional-networks',f'https://github.com/fkunn1326/openpose-editor',f'https://github.com/nonnonstop/sd-webui-3d-open-pose-editor',f'https://github.com/Physton/sd-webui-prompt-all-in-one',f'https://github.com/Bing-su/adetailer',f'https://github.com/picobyte/stable-diffusion-webui-wd14-tagger',f'https://github.com/Mikubill/sd-webui-controlnet',f'https://github.com/IDEA-Research/DWPose',f'https://github.com/hanamizuki-ai/stable-diffusion-webui-localization-zh_Hans',f'https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111',]#line:58
13
+ for OO00OOOOOO0000O00 in O00OOOOOOOO0OOO0O :#line:59
14
+ O0O0OO0OO0O0O0O00 =OO00OOOOOO0000O00 .split ('/')[-1 ]#line:61
15
+ if 'github'in OO00OOOOOO0000O00 :#line:63
16
+ get_ipython ().system (f'git clone --depth 1 {OO00OOOOOO0000O00} {wb}/extensions/{O0O0OO0OO0O0O0O00}')#line:64
17
  get_ipython ().system (f'wget https://raw.githubuserhome/studio-lab-user.com/camenduru/stable-diffusion-webui-scripts/main/run_n_times.py -O {wb}/scripts/run_n_times.py')#line:66
18
  gitDownload (f'https://huggingface.co/embed/negative',f'{wb}/embeddings/negative')#line:70
19
  get_ipython ().system (f'rm -rf {wb}/embeddings/negative/.git')#line:71
 
31
  print ('Roop换脸启用')#line:88
32
  import subprocess #line:90
33
  def sync_tmp_folder ():#line:92
34
+ O0O0OOO000OO0O0OO =[['rm','-rf','~/tmp/*','~/tmp','~/stable-diffusion-webui/models/Stable-diffusion/tmp_models','~/stable-diffusion-webui/models/ControlNet'],['ln','-vs','/tmp','~/tmp'],['ln','-vs','/tmp/models','~/stable-diffusion-webui/models/Stable-diffusion/tmp_models'],['ln','-vs','/tmp/ControlNet','~/stable-diffusion-webui/models/ControlNet']]#line:98
35
+ for O00O0O0OOOOO000O0 in O0O0OOO000OO0O0OO :#line:100
36
+ OOO00O0OO0OO0OO0O =[os .path .expanduser (O0O0OOOO0O0000OOO )for O0O0OOOO0O0000OOO in O00O0O0OOOOO000O0 ]#line:101
37
+ subprocess .run (OOO00O0OO0OO0OO0O ,check =True )#line:102
38
+ def run_command (OO0OO00O0OOOOO0OO ,O0O000OO00O0OO0OO ):#line:104
39
+ print (f"Please wait, {O0O000OO00O0OO0OO} is loading...")#line:105
40
+ subprocess .run (OO0OO00O0OOOOO0OO ,shell =True ,stdout =subprocess .DEVNULL ,stderr =subprocess .DEVNULL )#line:106
41
+ print (f"{O0O000OO00O0OO0OO} ok!")#line:107
42
  def initLocal ():#line:110
43
  run_command ('conda install conda -y','Conda')#line:112
44
  run_command ('conda update -n base conda -y','Update')#line:114
 
47
  run_command ('pip install torch==2.1.0 torchvision==0.16.0 --extra-index-url https://download.pytorch.org/whl/cu121','【 Installing Torch 】')#line:118
48
  run_command ('pip install xformers==0.0.22.post7','【 Installing xformers 】')#line:119
49
  get_ipython ().system ('pip install -q aria2')#line:120
50
+ clear_output ()#line:123
51
+ get_ipython ().run_line_magic ('cd','/home/studio-lab-user')#line:124
52
+ get_ipython ().system (f'git clone -q --branch master https://github.com/AUTOMATIC1111/stable-diffusion-webui {wb}')#line:127
53
+ sync_tmp_folder ()#line:130
54
+ clear_output ()#line:132
55
+ get_ipython ().system (f'pip install -q basicsr')#line:137
56
+ get_ipython ().system (f'pip install -q fake_useragent')#line:138
57
+ installAdditional ()#line:143
58
+ get_ipython ().system (f'rm -rf {wb}/config.json')#line:146
59
+ get_ipython ().system (f'wget -O {wb}/config.json "https://huggingface.co/gmk123/colab/raw/main/config.json"')#line:147
60
+ get_ipython ().system (f'wget -O {wb}/styles.csv "https://huggingface.co/gmk123/colab/raw/main/styles.csv"')#line:148
61
+ clear_output ()#line:150
62
+ get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/192916 -d {wb}/models/Stable-diffusion -o MoyouArtificial_v1060.safetensors')#line:152
63
+ 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:154
64
+ 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
65
+ wise ="--listen --api --enable-insecure-extension-access --xformers --theme dark --gradio-queue --disable-console-progressbars --upcast-sampling --cors-allow-origins=*"#line:158
66
+ ngrok_token =os .environ .get ('NGROK_TOKEN')#line:161
67
+ wise +=f" --ngrok {ngrok_token}"#line:162
68
+ def run (OOOO0O0OO0O000OO0 ):#line:165
69
+ clear_output ()#line:166
70
+ print (f'Ngrok内网令牌:{ngrok_token}')#line:167
71
+ print (f'Ngrok注意事项:每个账号每月1G流量!!!请留意后台剩余流量。')#line:168
72
+ print (f'Ngrok剩余流量:点击查看 -- https://dashboard.ngrok.com/usage')#line:169
73
+ get_ipython ().system (f'mkdir -p /tmp/ControlNet')#line:170
74
+ get_ipython ().run_line_magic ('cd',f'{wb}')#line:172
75
+ get_ipython ().system (f'python {OOOO0O0OO0O000OO0} {wise}')#line:173
76
+ if os .path .exists (f'{wb}'):#line:176
77
+ run (f'webui.py')#line:178
78
+ else :#line:179
79
+ initLocal ()#line:181
80
+ run (f'launch.py')#line:184