gmk123 commited on
Commit
86fc8d3
·
verified ·
1 Parent(s): f5c7064

Update sagemaker.py

Browse files
Files changed (1) hide show
  1. sagemaker.py +19 -20
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 (O00OOOO00OO00OO00 ,O0O0O00000OOO0000 ):#line:11
8
- if os .path .exists (O0O0O00000OOO0000 ):#line:12
9
  return #line:13
10
- get_ipython ().system (f'git clone {O00OOOO00OO00OO00} {O0O0O00000OOO0000}')#line:15
11
  def installAdditional ():#line:18
12
- OO0O00O0OOOOO0000 =[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 OOOOOOO0000O0O00O in OO0O00O0OOOOO0000 :#line:59
14
- OO00000000OOOOOO0 =OOOOOOO0000O0O00O .split ('/')[-1 ]#line:61
15
- if 'github'in OOOOOOO0000O0O00O :#line:63
16
- get_ipython ().system (f'git clone --depth 1 {OOOOOOO0000O0O00O} {wb}/extensions/{OO00000000OOOOOO0}')#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,19 +31,18 @@ def installAdditional ():#line:18
31
  print ('Roop换脸启用')#line:88
32
  import subprocess #line:90
33
  def sync_tmp_folder ():#line:92
34
- O0O0OO0O00O0OOOO0 =[['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 OO0O0OO00O0OO0000 in O0O0OO0O00O0OOOO0 :#line:100
36
- O0O000OOO00OOO0O0 =[os .path .expanduser (O00OO0O0O00O00OOO )for O00OO0O0O00O00OOO in OO0O0OO00O0OO0000 ]#line:101
37
- subprocess .run (O0O000OOO00OOO0O0 ,check =True )#line:102
38
- def run_command (O0000OOOO0O00O000 ,OOOO00O0OOO0OO00O ):#line:104
39
- print (f"Please wait, {OOOO00O0OOO0OO00O} is loading...")#line:105
40
- subprocess .run (O0000OOOO0O00O000 ,shell =True ,stdout =subprocess .DEVNULL ,stderr =subprocess .DEVNULL )#line:106
41
- print (f"{OOOO00O0OOO0OO00O} 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 -y','Python')#line:115
46
- run_command ('pip install torch==2.0.1+cu118 torchvision==0.15.2+cu118 --extra-index-url https://download.pytorch.org/whl/cu118','【 Installing Torch 】')#line:118
47
  run_command ('pip install xformers==0.0.20 triton==2.0.0','【 Installing xformers 】')#line:119
48
  get_ipython ().system ('pip install -q aria2')#line:120
49
  clear_output ()#line:123
@@ -64,14 +63,14 @@ def initLocal ():#line:110
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 (O0OOOO0OO00O0OO00 ):#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 {O0OOOO0OO00O0OO00} {wise}')#line:173
75
  if os .path .exists (f'{wb}'):#line:176
76
  run (f'webui.py')#line:178
77
  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 (O000O0OO000OOOO0O ,O0O000OOOOOO00OO0 ):#line:11
8
+ if os .path .exists (O0O000OOOOOO00OO0 ):#line:12
9
  return #line:13
10
+ get_ipython ().system (f'git clone {O000O0OO000OOOO0O} {O0O000OOOOOO00OO0}')#line:15
11
  def installAdditional ():#line:18
12
+ OOOOO0O00O0000OOO =[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 O00OOOOOOOO00O0OO in OOOOO0O00O0000OOO :#line:59
14
+ OO0O0O00O00000OOO =O00OOOOOOOO00O0OO .split ('/')[-1 ]#line:61
15
+ if 'github'in O00OOOOOOOO00O0OO :#line:63
16
+ get_ipython ().system (f'git clone --depth 1 {O00OOOOOOOO00O0OO} {wb}/extensions/{OO0O0O00O00000OOO}')#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
+ O0O0OOO0OO0OO0O00 =[['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 OOO0O0OO0OO0O000O in O0O0OOO0OO0OO0O00 :#line:100
36
+ OOO0OOO0O0OO0OOOO =[os .path .expanduser (OOO0OOO00O000O0OO )for OOO0OOO00O000O0OO in OOO0O0OO0OO0O000O ]#line:101
37
+ subprocess .run (OOO0OOO0O0OO0OOOO ,check =True )#line:102
38
+ def run_command (OO000OO00OO00OO0O ,OOOOO0OO00O00000O ):#line:104
39
+ print (f"Please wait, {OOOOO0OO00O00000O} is loading...")#line:105
40
+ subprocess .run (OO000OO00OO00OO0O ,shell =True ,stdout =subprocess .DEVNULL ,stderr =subprocess .DEVNULL )#line:106
41
+ print (f"{OOOOO0OO00O00000O} 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.2+cu118 torchvision==0.16.0+cu118 --extra-index-url https://download.pytorch.org/whl/cu118','【 Installing Torch 】')#line:118
 
46
  run_command ('pip install xformers==0.0.20 triton==2.0.0','【 Installing xformers 】')#line:119
47
  get_ipython ().system ('pip install -q aria2')#line:120
48
  clear_output ()#line:123
 
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 (O00O0O0OO0O0O000O ):#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 {O00O0O0OO0O0O000O} {wise}')#line:173
74
  if os .path .exists (f'{wb}'):#line:176
75
  run (f'webui.py')#line:178
76
  else :#line:179