Instructions to use gmk123/colab with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gmk123/colab with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("gmk123/colab", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update sagemaker.py
Browse files- 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 (
|
| 8 |
-
if os .path .exists (
|
| 9 |
return #line:13
|
| 10 |
-
get_ipython ().system (f'git clone {
|
| 11 |
def installAdditional ():#line:18
|
| 12 |
-
|
| 13 |
-
for
|
| 14 |
-
|
| 15 |
-
if 'github'in
|
| 16 |
-
get_ipython ().system (f'git clone --depth 1 {
|
| 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 |
-
|
| 36 |
-
for
|
| 37 |
-
|
| 38 |
-
subprocess .run (
|
| 39 |
-
def run_command (
|
| 40 |
-
print (f"Please wait, {
|
| 41 |
-
subprocess .run (
|
| 42 |
-
print (f"{
|
| 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 (
|
| 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 {
|
| 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
|