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 comfyui_tmp.py
Browse files- comfyui_tmp.py +30 -30
comfyui_tmp.py
CHANGED
|
@@ -4,39 +4,39 @@ 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/ComfyUI'#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 |
get_ipython ().system (f'git clone --recursive https://github.com/ssitu/ComfyUI_UltimateSDUpscale {wb}/custom_nodes/ComfyUI_UltimateSDUpscale')#line:20
|
| 13 |
-
|
| 14 |
-
for
|
| 15 |
-
|
| 16 |
-
if 'github'in
|
| 17 |
-
get_ipython ().system (f'git clone --depth 1 {
|
| 18 |
get_ipython ().system (f'wget https://huggingface.co/pantat88/ui/resolve/main/embeddings.zip -O {wb}/models/embeddings/embeddings.zip')#line:47
|
| 19 |
get_ipython ().system (f'wget https://civitai.com/api/download/models/150491 -O {wb}/models/embeddings/edgQuality.pt')#line:48
|
| 20 |
clear_output ()#line:50
|
| 21 |
import subprocess #line:52
|
| 22 |
def sync_tmp_folder ():#line:54
|
| 23 |
-
|
| 24 |
-
for
|
| 25 |
-
|
| 26 |
-
subprocess .run (
|
| 27 |
-
def run_command (
|
| 28 |
-
print (f"Please wait, {
|
| 29 |
-
subprocess .run (
|
| 30 |
-
print (f"{
|
| 31 |
def zrok ():#line:75
|
| 32 |
try :#line:76
|
| 33 |
-
|
| 34 |
-
os .makedirs (
|
| 35 |
subprocess .run (["curl","-sLO","https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz"],check =True )#line:79
|
| 36 |
-
subprocess .run (["tar","-xzf","zrok_0.4.23_linux_amd64.tar.gz","-C",
|
| 37 |
os .remove ("zrok_0.4.23_linux_amd64.tar.gz")#line:81
|
| 38 |
-
except Exception as
|
| 39 |
-
print (f"An error occurred: {
|
| 40 |
def initLocal ():#line:88
|
| 41 |
run_command ('conda install -y conda glib gxx_linux-64 ffmpeg imageio imageio-ffmpeg av gst-libav psutil pyngrok gperftools aria2 gdown','【 Installing Conda 】')#line:90
|
| 42 |
run_command ('conda install -y -n base python=3.10.12','【 Installing Python 3.10 】')#line:91
|
|
@@ -44,10 +44,10 @@ def initLocal ():#line:88
|
|
| 44 |
get_ipython ().system ('pip install -q tqdm')#line:96
|
| 45 |
clear_output ()#line:98
|
| 46 |
get_ipython ().run_line_magic ('cd','/home/studio-lab-user')#line:99
|
| 47 |
-
with capture .capture_output ()as
|
| 48 |
-
def
|
| 49 |
get_ipython ().system (f'git clone -q https://github.com/comfyanonymous/ComfyUI {wb}')#line:105
|
| 50 |
-
with capture .capture_output ()as
|
| 51 |
get_ipython ().run_line_magic ('cd',f'{wb}')#line:108
|
| 52 |
get_ipython ().system ("pip install -q https://download.pytorch.org/whl/cu118/xformers-0.0.22.post4%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu118")#line:110
|
| 53 |
get_ipython ().system ('pip install -q -r requirements.txt')#line:111
|
|
@@ -58,8 +58,8 @@ def initLocal ():#line:88
|
|
| 58 |
get_ipython ().system (f'pip install -q basicsr')#line:119
|
| 59 |
clear_output ()#line:121
|
| 60 |
zrok ()#line:125
|
| 61 |
-
get_ipython ().system (f'wget https://huggingface.co/gmk123/
|
| 62 |
-
get_ipython ().system (f'wget https://huggingface.co/gmk123/
|
| 63 |
installAdditional ()#line:130
|
| 64 |
sync_tmp_folder ()#line:133
|
| 65 |
clear_output ()#line:140
|
|
@@ -75,15 +75,15 @@ def initLocal ():#line:88
|
|
| 75 |
wise ="--xformers --enable-insecure-extension-access --theme dark --disable-console-progressbars --upcast-sampling"#line:155
|
| 76 |
ngrok_token =os .environ .get ('NGROK_TOKEN')#line:158
|
| 77 |
wise +=f" --ngrok {ngrok_token}"#line:159
|
| 78 |
-
def run (
|
| 79 |
clear_output ()#line:163
|
| 80 |
print (f'建议使用第二步:zrok部署,无需魔法,没有流量限制')#line:164
|
| 81 |
print (f'Ngrok注意事项:每个账号每月1G流量!需配合魔法使用')#line:165
|
| 82 |
get_ipython ().system (f'mkdir -p /tmp/ControlNet')#line:166
|
| 83 |
get_ipython ().run_line_magic ('cd',f'{wb}')#line:168
|
| 84 |
-
get_ipython ().system (f'python {
|
| 85 |
if os .path .exists (f'{wb}'):#line:172
|
| 86 |
-
run (f'
|
| 87 |
else :#line:175
|
| 88 |
initLocal ()#line:177
|
| 89 |
-
run (f'
|
|
|
|
| 4 |
from IPython .utils import capture #line:4
|
| 5 |
from IPython .display import clear_output #line:5
|
| 6 |
wb =f'/home/studio-lab-user/ComfyUI'#line:8
|
| 7 |
+
def gitDownload (O000O0OO0O0OOOOO0 ,O00O0OOO00O0O0O0O ):#line:11
|
| 8 |
+
if os .path .exists (O00O0OOO00O0O0O0O ):#line:12
|
| 9 |
return #line:13
|
| 10 |
+
get_ipython ().system (f'git clone {O000O0OO0O0OOOOO0} {O00O0OOO00O0O0O0O}')#line:15
|
| 11 |
def installAdditional ():#line:18
|
| 12 |
get_ipython ().system (f'git clone --recursive https://github.com/ssitu/ComfyUI_UltimateSDUpscale {wb}/custom_nodes/ComfyUI_UltimateSDUpscale')#line:20
|
| 13 |
+
O0OOOOOOO0O00OO0O =['https://github.com/ltdrdata/ComfyUI-Manager','https://github.com/pythongosssss/ComfyUI-Custom-Scripts','https://github.com/city96/SD-Latent-Upscaler','https://github.com/jags111/efficiency-nodes-comfyui','https://github.com/BlenderNeko/ComfyUI_ADV_CLIP_emb','https://github.com/ssitu/ComfyUI_NestedNodeBuilder','https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet','https://github.com/Fannovel16/comfyui_controlnet_aux','https://github.com/SLAPaper/ComfyUI-Image-Selector','https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes','https://github.com/FizzleDorf/ComfyUI_FizzNodes','https://github.com/WASasquatch/was-node-suite-comfyui','https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite','https://github.com/Gourieff/comfyui-reactor-node',]#line:38
|
| 14 |
+
for O0O0O0000OOOOOO00 in O0OOOOOOO0O00OO0O :#line:39
|
| 15 |
+
OOO00OOO0OO0OOOOO =O0O0O0000OOOOOO00 .split ('/')[-1 ]#line:41
|
| 16 |
+
if 'github'in O0O0O0000OOOOOO00 :#line:43
|
| 17 |
+
get_ipython ().system (f'git clone --depth 1 {O0O0O0000OOOOOO00} {wb}/custom_nodes/{OOO00OOO0OO0OOOOO}')#line:44
|
| 18 |
get_ipython ().system (f'wget https://huggingface.co/pantat88/ui/resolve/main/embeddings.zip -O {wb}/models/embeddings/embeddings.zip')#line:47
|
| 19 |
get_ipython ().system (f'wget https://civitai.com/api/download/models/150491 -O {wb}/models/embeddings/edgQuality.pt')#line:48
|
| 20 |
clear_output ()#line:50
|
| 21 |
import subprocess #line:52
|
| 22 |
def sync_tmp_folder ():#line:54
|
| 23 |
+
OO000OOOO00OO0OO0 =[['rm','-rf','~/tmp/*','~/tmp','~/ComfyUI/models/checkpoints','~/ComfyUI/models/loras','~/ComfyUI/models/controlnet'],['ln','-vs','/tmp','~/tmp'],['ln','-vs','/tmp/models','~/ComfyUI/models/checkpoints'],['ln','-vs','/tmp/Lora','~/ComfyUI/models/loras'],['ln','-vs','/tmp/ControlNet','~/ComfyUI/models/controlnet'],['unzip','-o','~/ComfyUI/models/embeddings.zip','-d','~/ComfyUI/models/embeddings'],['rm','~/ComfyUI/models/embeddings.zip']]#line:63
|
| 24 |
+
for OOO0O0OO000000O0O in OO000OOOO00OO0OO0 :#line:64
|
| 25 |
+
OOO0O0OOO0000O0O0 =[os .path .expanduser (OO00000O00OO000O0 )for OO00000O00OO000O0 in OOO0O0OO000000O0O ]#line:65
|
| 26 |
+
subprocess .run (OOO0O0OOO0000O0O0 ,check =True )#line:66
|
| 27 |
+
def run_command (OOO0OOO0O0O0O00O0 ,O0O00OOO00000O0O0 ):#line:69
|
| 28 |
+
print (f"Please wait, {O0O00OOO00000O0O0} is loading...")#line:70
|
| 29 |
+
subprocess .run (OOO0OOO0O0O0O00O0 ,shell =True ,stdout =subprocess .DEVNULL ,stderr =subprocess .DEVNULL )#line:71
|
| 30 |
+
print (f"{O0O00OOO00000O0O0} ok!")#line:72
|
| 31 |
def zrok ():#line:75
|
| 32 |
try :#line:76
|
| 33 |
+
O00OOOO0OO000OO00 ="/home/studio-lab-user/.zrok/bin"#line:77
|
| 34 |
+
os .makedirs (O00OOOO0OO000OO00 ,exist_ok =True )#line:78
|
| 35 |
subprocess .run (["curl","-sLO","https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz"],check =True )#line:79
|
| 36 |
+
subprocess .run (["tar","-xzf","zrok_0.4.23_linux_amd64.tar.gz","-C",O00OOOO0OO000OO00 ,"--wildcards","*zrok"],check =True )#line:80
|
| 37 |
os .remove ("zrok_0.4.23_linux_amd64.tar.gz")#line:81
|
| 38 |
+
except Exception as O0O00OO00000OOOO0 :#line:83
|
| 39 |
+
print (f"An error occurred: {O0O00OO00000OOOO0}")#line:84
|
| 40 |
def initLocal ():#line:88
|
| 41 |
run_command ('conda install -y conda glib gxx_linux-64 ffmpeg imageio imageio-ffmpeg av gst-libav psutil pyngrok gperftools aria2 gdown','【 Installing Conda 】')#line:90
|
| 42 |
run_command ('conda install -y -n base python=3.10.12','【 Installing Python 3.10 】')#line:91
|
|
|
|
| 44 |
get_ipython ().system ('pip install -q tqdm')#line:96
|
| 45 |
clear_output ()#line:98
|
| 46 |
get_ipython ().run_line_magic ('cd','/home/studio-lab-user')#line:99
|
| 47 |
+
with capture .capture_output ()as OO0OO0OOO00OOOOO0 :#line:102
|
| 48 |
+
def OO000O0O0OO00000O (OOOOOO0O000O0O00O ,OO0O0O00OOOO00OOO ,O000OO00OOOOO0OO0 ):O00O00000O00O0O00 =widgets .Button (description =OOOOOO0O000O0O00O ,disabled =True ,button_style =OO0O0O00OOOO00OOO ,layout =widgets .Layout (min_width =O000OO00OOOOO0OO0 ));display (O00O00000O00O0O00 )#line:103
|
| 49 |
get_ipython ().system (f'git clone -q https://github.com/comfyanonymous/ComfyUI {wb}')#line:105
|
| 50 |
+
with capture .capture_output ()as OO0OO0OOO00OOOOO0 :#line:107
|
| 51 |
get_ipython ().run_line_magic ('cd',f'{wb}')#line:108
|
| 52 |
get_ipython ().system ("pip install -q https://download.pytorch.org/whl/cu118/xformers-0.0.22.post4%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu118")#line:110
|
| 53 |
get_ipython ().system ('pip install -q -r requirements.txt')#line:111
|
|
|
|
| 58 |
get_ipython ().system (f'pip install -q basicsr')#line:119
|
| 59 |
clear_output ()#line:121
|
| 60 |
zrok ()#line:125
|
| 61 |
+
get_ipython ().system (f'wget https://huggingface.co/gmk123/comfyui/raw/main/zrun.py -O {wb}/zrun.py')#line:126
|
| 62 |
+
get_ipython ().system (f'wget https://huggingface.co/gmk123/comfyui/raw/main/zrok.py -O {wb}/zrok.py')#line:127
|
| 63 |
installAdditional ()#line:130
|
| 64 |
sync_tmp_folder ()#line:133
|
| 65 |
clear_output ()#line:140
|
|
|
|
| 75 |
wise ="--xformers --enable-insecure-extension-access --theme dark --disable-console-progressbars --upcast-sampling"#line:155
|
| 76 |
ngrok_token =os .environ .get ('NGROK_TOKEN')#line:158
|
| 77 |
wise +=f" --ngrok {ngrok_token}"#line:159
|
| 78 |
+
def run (OOO00OO0000000O00 ):#line:162
|
| 79 |
clear_output ()#line:163
|
| 80 |
print (f'建议使用第二步:zrok部署,无需魔法,没有流量限制')#line:164
|
| 81 |
print (f'Ngrok注意事项:每个账号每月1G流量!需配合魔法使用')#line:165
|
| 82 |
get_ipython ().system (f'mkdir -p /tmp/ControlNet')#line:166
|
| 83 |
get_ipython ().run_line_magic ('cd',f'{wb}')#line:168
|
| 84 |
+
get_ipython ().system (f'python {OOO00OO0000000O00} {wise}')#line:169
|
| 85 |
if os .path .exists (f'{wb}'):#line:172
|
| 86 |
+
run (f'main.py')#line:174
|
| 87 |
else :#line:175
|
| 88 |
initLocal ()#line:177
|
| 89 |
+
run (f'main.py')#line:180
|