gmk123 commited on
Commit
81e8f98
·
verified ·
1 Parent(s): e9c625c

Update sagemaker.py

Browse files
Files changed (1) hide show
  1. sagemaker.py +19 -18
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 (O00OO00OOO000O00O ,OO0O00OOOO00O0O0O ):#line:11
8
- if os .path .exists (OO0O00OOOO00O0O0O ):#line:12
9
  return #line:13
10
- get_ipython ().system (f'git clone {O00OO00OOO000O00O} {OO0O00OOOO00O0O0O}')#line:15
11
  def installAdditional ():#line:18
12
- O0O000O0O000O00OO =[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 OO00O0O0OOOOOOO0O in O0O000O0O000O00OO :#line:59
14
- OOOO0O0OO0OOOO00O =OO00O0O0OOOOOOO0O .split ('/')[-1 ]#line:61
15
- if 'github'in OO00O0O0OOOOOOO0O :#line:63
16
- get_ipython ().system (f'git clone --depth 1 {OO00O0O0OOOOOOO0O} {wb}/extensions/{OOOO0O0OO0OOOO00O}')#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,17 +31,18 @@ def installAdditional ():#line:18
31
  print ('Roop换脸启用')#line:88
32
  import subprocess #line:90
33
  def sync_tmp_folder ():#line:92
34
- O0O0OOOO00OO0OOOO =[['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 O000O0OOOOO0OO000 in O0O0OOOO00OO0OOOO :#line:100
36
- OOO0O0O0OOOO0O0OO =[os .path .expanduser (O00000000OO00O00O )for O00000000OO00O00O in O000O0OOOOO0OO000 ]#line:101
37
- subprocess .run (OOO0O0O0OOOO0O0OO ,check =True )#line:102
38
- def run_command (O00OOO000OO0OOOO0 ,OOOOO0OO0O00OO000 ):#line:104
39
- print (f"Please wait, {OOOOO0OO0O00OO000} is loading...")#line:105
40
- subprocess .run (O00OOO000OO0OOOO0 ,shell =True ,stdout =subprocess .DEVNULL ,stderr =subprocess .DEVNULL )#line:106
41
- print (f"{OOOOO0OO0O00OO000} ok!")#line:107
42
  def initLocal ():#line:110
43
  run_command ('conda install -c conda-forge libglib -y','libglib')#line:113
44
  run_command ('conda update -n base conda -y','Update')#line:114
 
45
  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
46
  run_command ('pip install xformers==0.0.22.post7','【 Installing xformers 】')#line:119
47
  get_ipython ().system ('pip install -q aria2')#line:120
@@ -63,14 +64,14 @@ def initLocal ():#line:110
63
  wise ="--listen --api --enable-insecure-extension-access --xformers --theme dark --gradio-queue --disable-console-progressbars --upcast-sampling --cors-allow-origins=*"#line:158
64
  ngrok_token =os .environ .get ('NGROK_TOKEN')#line:161
65
  wise +=f" --ngrok {ngrok_token}"#line:162
66
- def run (OOO0O0O00O0OO0000 ):#line:165
67
  clear_output ()#line:166
68
  print (f'Ngrok内网令牌:{ngrok_token}')#line:167
69
  print (f'Ngrok注意事项:每个账号每月1G流量!!!请留意后台剩余流量。')#line:168
70
  print (f'Ngrok剩余流量:点击查看 -- https://dashboard.ngrok.com/usage')#line:169
71
  get_ipython ().system (f'mkdir -p /tmp/ControlNet')#line:170
72
  get_ipython ().run_line_magic ('cd',f'{wb}')#line:172
73
- get_ipython ().system (f'python {OOO0O0O00O0OO0000} {wise}')#line:173
74
  if os .path .exists (f'{wb}'):#line:176
75
  run (f'webui.py')#line:178
76
  else :#line:179
 
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 (O0OOOO0O0O00000O0 ,O0O0000000OOO0O0O ):#line:11
8
+ if os .path .exists (O0O0000000OOO0O0O ):#line:12
9
  return #line:13
10
+ get_ipython ().system (f'git clone {O0OOOO0O0O00000O0} {O0O0000000OOO0O0O}')#line:15
11
  def installAdditional ():#line:18
12
+ OO0O00OOO00OOO000 =[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 OOO0OO000O0O00000 in OO0O00OOO00OOO000 :#line:59
14
+ O0OOOOO0O0000OO00 =OOO0OO000O0O00000 .split ('/')[-1 ]#line:61
15
+ if 'github'in OOO0OO000O0O00000 :#line:63
16
+ get_ipython ().system (f'git clone --depth 1 {OOO0OO000O0O00000} {wb}/extensions/{O0OOOOO0O0000OO00}')#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
+ O0OOOOO00O0OO0OOO =[['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 OO0OO0OO0O0000O00 in O0OOOOO00O0OO0OOO :#line:100
36
+ O0OOOOO00O0OOO0O0 =[os .path .expanduser (OOO00OO0OOOO0OO00 )for OOO00OO0OOOO0OO00 in OO0OO0OO0O0000O00 ]#line:101
37
+ subprocess .run (O0OOOOO00O0OOO0O0 ,check =True )#line:102
38
+ def run_command (O000O0O0OOO0000OO ,O000O00O00OO0OOOO ):#line:104
39
+ print (f"Please wait, {O000O00O00OO0OOOO} is loading...")#line:105
40
+ subprocess .run (O000O0O0OOO0000OO ,shell =True ,stdout =subprocess .DEVNULL ,stderr =subprocess .DEVNULL )#line:106
41
+ print (f"{O000O00O00OO0OOOO} ok!")#line:107
42
  def initLocal ():#line:110
43
  run_command ('conda install -c conda-forge libglib -y','libglib')#line:113
44
  run_command ('conda update -n base conda -y','Update')#line:114
45
+ run_command ('conda install -n base python=3.10.6 -y','Python')#line:115
46
  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
47
  run_command ('pip install xformers==0.0.22.post7','【 Installing xformers 】')#line:119
48
  get_ipython ().system ('pip install -q aria2')#line:120
 
64
  wise ="--listen --api --enable-insecure-extension-access --xformers --theme dark --gradio-queue --disable-console-progressbars --upcast-sampling --cors-allow-origins=*"#line:158
65
  ngrok_token =os .environ .get ('NGROK_TOKEN')#line:161
66
  wise +=f" --ngrok {ngrok_token}"#line:162
67
+ def run (OO00OO0O0O0000OO0 ):#line:165
68
  clear_output ()#line:166
69
  print (f'Ngrok内网令牌:{ngrok_token}')#line:167
70
  print (f'Ngrok注意事项:每个账号每月1G流量!!!请留意后台剩余流量。')#line:168
71
  print (f'Ngrok剩余流量:点击查看 -- https://dashboard.ngrok.com/usage')#line:169
72
  get_ipython ().system (f'mkdir -p /tmp/ControlNet')#line:170
73
  get_ipython ().run_line_magic ('cd',f'{wb}')#line:172
74
+ get_ipython ().system (f'python {OO00OO0O0O0000OO0} {wise}')#line:173
75
  if os .path .exists (f'{wb}'):#line:176
76
  run (f'webui.py')#line:178
77
  else :#line:179