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 +45 -45
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
|
|
@@ -50,31 +50,31 @@ def initLocal ():#line:110
|
|
| 50 |
clear_output ()#line:120
|
| 51 |
get_ipython ().run_line_magic ('cd','/home/studio-lab-user')#line:121
|
| 52 |
get_ipython ().system (f'git clone -q --branch master https://github.com/AUTOMATIC1111/stable-diffusion-webui {wb}')#line:124
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
get_ipython ().system (f'pip install -q fake_useragent')#line:
|
| 57 |
-
installAdditional ()#line:
|
| 58 |
-
get_ipython ().system (f'rm -rf {wb}/config.json')#line:
|
| 59 |
-
get_ipython ().system (f'wget -O {wb}/config.json "https://huggingface.co/gmk123/colab/raw/main/config.json"')#line:
|
| 60 |
-
get_ipython ().system (f'wget -O {wb}/styles.csv "https://huggingface.co/gmk123/colab/raw/main/styles.csv"')#line:
|
| 61 |
-
clear_output ()#line:
|
| 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:
|
| 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:
|
| 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:
|
| 65 |
-
wise ="--listen --api --enable-insecure-extension-access --xformers --theme dark --gradio-queue --disable-console-progressbars --upcast-sampling --skip-version-check"#line:
|
| 66 |
-
ngrok_token =os .environ .get ('NGROK_TOKEN')#line:
|
| 67 |
-
wise +=f" --ngrok {ngrok_token}"#line:
|
| 68 |
-
def run (
|
| 69 |
-
clear_output ()#line:
|
| 70 |
-
print (f'Ngrok内网令牌:{ngrok_token}')#line:
|
| 71 |
-
print (f'Ngrok注意事项:每个账号每月1G流量!!!请留意后台剩余流量。')#line:
|
| 72 |
-
print (f'Ngrok剩余流量:点击查看 -- https://dashboard.ngrok.com/usage')#line:
|
| 73 |
-
get_ipython ().system (f'mkdir -p /tmp/ControlNet')#line:
|
| 74 |
-
get_ipython ().run_line_magic ('cd',f'{wb}')#line:
|
| 75 |
-
get_ipython ().system (f'python {
|
| 76 |
-
if os .path .exists (f'{wb}'):#line:
|
| 77 |
-
run (f'webui.py')#line:
|
| 78 |
-
else :#line:
|
| 79 |
-
initLocal ()#line:
|
| 80 |
-
run (f'launch.py')#line:
|
|
|
|
| 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 (O00O0O0OOO0OOO0OO ,O00O0000O0O000OOO ):#line:11
|
| 8 |
+
if os .path .exists (O00O0000O0O000OOO ):#line:12
|
| 9 |
return #line:13
|
| 10 |
+
get_ipython ().system (f'git clone {O00O0O0OOO0OOO0OO} {O00O0000O0O000OOO}')#line:15
|
| 11 |
def installAdditional ():#line:18
|
| 12 |
+
OOO0O0OO0000O00O0 =[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 OO0OOOOO00O0OO000 in OOO0O0OO0000O00O0 :#line:59
|
| 14 |
+
OOOO0OOO00O00O0OO =OO0OOOOO00O0OO000 .split ('/')[-1 ]#line:61
|
| 15 |
+
if 'github'in OO0OOOOO00O0OO000 :#line:63
|
| 16 |
+
get_ipython ().system (f'git clone --depth 1 {OO0OOOOO00O0OO000} {wb}/extensions/{OOOO0OOO00O00O0OO}')#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 -q 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 |
+
OO0O0OO00OOO0OOOO =[['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 OO0OO00OO0OOO0000 in OO0O0OO00OOO0OOOO :#line:100
|
| 37 |
+
OOO00000OO0000O00 =[os .path .expanduser (OOO00OO0OO000000O )for OOO00OO0OO000000O in OO0OO00OO0OOO0000 ]#line:101
|
| 38 |
+
subprocess .run (OOO00000OO0000O00 ,check =True )#line:102
|
| 39 |
+
def run_command (O0000OOOO0OOOO0OO ,O000O0O0OO0O0OO00 ):#line:104
|
| 40 |
+
print (f"Please wait, {O000O0O0OO0O0OO00} is loading...")#line:105
|
| 41 |
+
subprocess .run (O0000OOOO0OOOO0OO ,shell =True ,stdout =subprocess .DEVNULL ,stderr =subprocess .DEVNULL )#line:106
|
| 42 |
+
print (f"{O000O0O0OO0O0OO00} 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
|
|
|
|
| 50 |
clear_output ()#line:120
|
| 51 |
get_ipython ().run_line_magic ('cd','/home/studio-lab-user')#line:121
|
| 52 |
get_ipython ().system (f'git clone -q --branch master https://github.com/AUTOMATIC1111/stable-diffusion-webui {wb}')#line:124
|
| 53 |
+
get_ipython ().system ('pip install -q -r requirements.txt basicsr')#line:127
|
| 54 |
+
sync_tmp_folder ()#line:130
|
| 55 |
+
clear_output ()#line:132
|
| 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 --skip-version-check"#line:158
|
| 66 |
+
ngrok_token =os .environ .get ('NGROK_TOKEN')#line:161
|
| 67 |
+
wise +=f" --ngrok {ngrok_token}"#line:162
|
| 68 |
+
def run (OO000O00OOO0O0O00 ):#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 {OO000O00OOO0O0O00} {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
|