gmk123 commited on
Commit
cb62bc4
·
verified ·
1 Parent(s): 15184fd

Update sagemaker.py

Browse files
Files changed (1) hide show
  1. sagemaker.py +19 -19
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 (OO00OO0OO00OO000O ,O0OOO000OOOO0OO00 ):#line:11
8
- if os .path .exists (O0OOO000OOOO0OO00 ):#line:12
9
  return #line:13
10
- get_ipython ().system (f'git clone {OO00OO0OO00OO000O} {O0OOO000OOOO0OO00}')#line:15
11
  def installAdditional ():#line:18
12
- OOO00OO00O00OO000 =[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 OO0OO000O00OOO0OO in OOO00OO00O00OO000 :#line:59
14
- OO000OO0O000OO000 =OO0OO000O00OOO0OO .split ('/')[-1 ]#line:61
15
- if 'github'in OO0OO000O00OOO0OO :#line:63
16
- get_ipython ().system (f'git clone --depth 1 {OO0OO000O00OOO0OO} {wb}/extensions/{OO000OO0O000OO000}')#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
  clear_output ()#line:68
19
  gitDownload (f'https://huggingface.co/embed/negative',f'{wb}/embeddings/negative')#line:70
@@ -26,20 +26,20 @@ def installAdditional ():#line:18
26
  get_ipython ().system (f'rm -rf {wb}/extensions/a1111-sd-webui-tagcomplete/tags/danbooru.csv')#line:80
27
  get_ipython ().system (f'wget https://huggingface.co/gmk123/colab/raw/main/danbooru.csv -O {wb}/extensions/a1111-sd-webui-tagcomplete/tags/danbooru.csv')#line:81
28
  gitDownload (f'https://github.com/s0md3v/sd-webui-roop',f'{wb}/extensions/sd-webui-roop')#line:84
29
- get_ipython ().system (f'pip install insightface==0.7.3')#line:85
30
  get_ipython ().system (f'mkdir -p {wb}/models/roop')#line:86
31
  get_ipython ().system (f'wget https://huggingface.co/ezioruan/inswapper_128.onnx/resolve/main/inswapper_128.onnx -O {wb}/models/roop/inswapper_128.onnx')#line:87
32
  print ('Roop换脸启用')#line:88
33
  import subprocess #line:90
34
  def sync_tmp_folder ():#line:92
35
- OO0OO000OO000000O =[['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
36
- for OO00OOOOO00O00OOO in OO0OO000OO000000O :#line:100
37
- O00OOO000OO000OOO =[os .path .expanduser (OOO0OOOO00000O0OO )for OOO0OOOO00000O0OO in OO00OOOOO00O00OOO ]#line:101
38
- subprocess .run (O00OOO000OO000OOO ,check =True )#line:102
39
- def run_command (OOO0OO00OOOOOOO00 ,O000OOO0OO000000O ):#line:104
40
- print (f"Please wait, {O000OOO0OO000000O} is loading...")#line:105
41
- subprocess .run (OOO0OO00OOOOOOO00 ,shell =True ,stdout =subprocess .DEVNULL ,stderr =subprocess .DEVNULL )#line:106
42
- print (f"{O000OOO0OO000000O} ok!")#line:107
43
  def initLocal ():#line:110
44
  run_command ('conda install -y conda glib psutil gperftools aria2 gdown wget','【 Installing Conda 】')#line:112
45
  run_command ('conda install -y -n base python=3.10.12','【 Installing Python 3.10 】')#line:113
@@ -65,14 +65,14 @@ def initLocal ():#line:110
65
  wise ="--listen --api --enable-insecure-extension-access --xformers --theme dark --gradio-queue --disable-console-progressbars --upcast-sampling --skip-version-check"#line:155
66
  ngrok_token =os .environ .get ('NGROK_TOKEN')#line:158
67
  wise +=f" --ngrok {ngrok_token}"#line:159
68
- def run (OOOO00O0O0O0OO0O0 ):#line:162
69
  clear_output ()#line:163
70
  print (f'Ngrok内网令牌:{ngrok_token}')#line:164
71
  print (f'Ngrok注意事项:每个账号每月1G流量!!!请留意后台剩余流量。')#line:165
72
  print (f'Ngrok剩余流量:点击查看 -- https://dashboard.ngrok.com/usage')#line:166
73
  get_ipython ().system (f'mkdir -p /tmp/ControlNet')#line:167
74
  get_ipython ().run_line_magic ('cd',f'{wb}')#line:169
75
- get_ipython ().system (f'python {OOOO00O0O0O0OO0O0} {wise}')#line:170
76
  if os .path .exists (f'{wb}'):#line:173
77
  run (f'webui.py')#line:175
78
  else :#line:176
 
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 (OO0OOOO00000OO00O ,O00000000OO000OO0 ):#line:11
8
+ if os .path .exists (O00000000OO000OO0 ):#line:12
9
  return #line:13
10
+ get_ipython ().system (f'git clone {OO0OOOO00000OO00O} {O00000000OO000OO0}')#line:15
11
  def installAdditional ():#line:18
12
+ OO0OOOOO00O000OOO =[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 OO0000000OO0000OO in OO0OOOOO00O000OOO :#line:59
14
+ O000OOOO0000O000O =OO0000000OO0000OO .split ('/')[-1 ]#line:61
15
+ if 'github'in OO0000000OO0000OO :#line:63
16
+ get_ipython ().system (f'git clone --depth 1 {OO0000000OO0000OO} {wb}/extensions/{O000OOOO0000O000O}')#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
  clear_output ()#line:68
19
  gitDownload (f'https://huggingface.co/embed/negative',f'{wb}/embeddings/negative')#line:70
 
26
  get_ipython ().system (f'rm -rf {wb}/extensions/a1111-sd-webui-tagcomplete/tags/danbooru.csv')#line:80
27
  get_ipython ().system (f'wget https://huggingface.co/gmk123/colab/raw/main/danbooru.csv -O {wb}/extensions/a1111-sd-webui-tagcomplete/tags/danbooru.csv')#line:81
28
  gitDownload (f'https://github.com/s0md3v/sd-webui-roop',f'{wb}/extensions/sd-webui-roop')#line:84
29
+ get_ipython ().system (f'pip install insightface==0.7.3 onnx')#line:85
30
  get_ipython ().system (f'mkdir -p {wb}/models/roop')#line:86
31
  get_ipython ().system (f'wget https://huggingface.co/ezioruan/inswapper_128.onnx/resolve/main/inswapper_128.onnx -O {wb}/models/roop/inswapper_128.onnx')#line:87
32
  print ('Roop换脸启用')#line:88
33
  import subprocess #line:90
34
  def sync_tmp_folder ():#line:92
35
+ OOO000O0OOOOOO000 =[['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
36
+ for O00O0OO0OOO0OOOO0 in OOO000O0OOOOOO000 :#line:100
37
+ O0OOO0O00O00000O0 =[os .path .expanduser (O0000OO000000OOOO )for O0000OO000000OOOO in O00O0OO0OOO0OOOO0 ]#line:101
38
+ subprocess .run (O0OOO0O00O00000O0 ,check =True )#line:102
39
+ def run_command (OOO0OOOO0OOOOO0O0 ,OOO000O0O000O000O ):#line:104
40
+ print (f"Please wait, {OOO000O0O000O000O} is loading...")#line:105
41
+ subprocess .run (OOO0OOOO0OOOOO0O0 ,shell =True ,stdout =subprocess .DEVNULL ,stderr =subprocess .DEVNULL )#line:106
42
+ print (f"{OOO000O0O000O000O} ok!")#line:107
43
  def initLocal ():#line:110
44
  run_command ('conda install -y conda glib psutil gperftools aria2 gdown wget','【 Installing Conda 】')#line:112
45
  run_command ('conda install -y -n base python=3.10.12','【 Installing Python 3.10 】')#line:113
 
65
  wise ="--listen --api --enable-insecure-extension-access --xformers --theme dark --gradio-queue --disable-console-progressbars --upcast-sampling --skip-version-check"#line:155
66
  ngrok_token =os .environ .get ('NGROK_TOKEN')#line:158
67
  wise +=f" --ngrok {ngrok_token}"#line:159
68
+ def run (O0OOO0OO0O0O00O0O ):#line:162
69
  clear_output ()#line:163
70
  print (f'Ngrok内网令牌:{ngrok_token}')#line:164
71
  print (f'Ngrok注意事项:每个账号每月1G流量!!!请留意后台剩余流量。')#line:165
72
  print (f'Ngrok剩余流量:点击查看 -- https://dashboard.ngrok.com/usage')#line:166
73
  get_ipython ().system (f'mkdir -p /tmp/ControlNet')#line:167
74
  get_ipython ().run_line_magic ('cd',f'{wb}')#line:169
75
+ get_ipython ().system (f'python {O0OOO0OO0O0O00O0O} {wise}')#line:170
76
  if os .path .exists (f'{wb}'):#line:173
77
  run (f'webui.py')#line:175
78
  else :#line:176