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 +27 -27
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
|
|
@@ -72,16 +72,16 @@ def initLocal ():#line:88
|
|
| 72 |
get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/pantat88/ui/resolve/main/4x_NMKD-Superscale-SP_178000_G.pth -d {wb}/models/upscale_models -o 4x_NMKD-Superscale-SP_178000_G.pth')#line:150
|
| 73 |
get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth -d {wb}/models/facerestore_models -o codeformer.pth')#line:152
|
| 74 |
get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://github.com/TencentARC/GFPGAN/releases/download/v1.3.4/GFPGANv1.4.pth -d {wb}/models/facerestore_models -o GFPGANv1.4.pth')#line:153
|
| 75 |
-
wise ="
|
| 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'main.py')#line:174
|
| 87 |
else :#line:175
|
|
|
|
| 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 (O0000OOOOO000OO0O ,OOO00OO0000OO0O00 ):#line:11
|
| 8 |
+
if os .path .exists (OOO00OO0000OO0O00 ):#line:12
|
| 9 |
return #line:13
|
| 10 |
+
get_ipython ().system (f'git clone {O0000OOOOO000OO0O} {OOO00OO0000OO0O00}')#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 |
+
OOO00000O000OO0O0 =['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 O000O0OOOO0OOOOOO in OOO00000O000OO0O0 :#line:39
|
| 15 |
+
O0O00000000OOO0O0 =O000O0OOOO0OOOOOO .split ('/')[-1 ]#line:41
|
| 16 |
+
if 'github'in O000O0OOOO0OOOOOO :#line:43
|
| 17 |
+
get_ipython ().system (f'git clone --depth 1 {O000O0OOOO0OOOOOO} {wb}/custom_nodes/{O0O00000000OOO0O0}')#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 |
+
OO00OOOOO0O000O00 =[['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 OO0O0OO0000OOO0O0 in OO00OOOOO0O000O00 :#line:64
|
| 25 |
+
O000O0O00O0OOO0OO =[os .path .expanduser (OO0OO0000OOOOOOOO )for OO0OO0000OOOOOOOO in OO0O0OO0000OOO0O0 ]#line:65
|
| 26 |
+
subprocess .run (O000O0O00O0OOO0OO ,check =True )#line:66
|
| 27 |
+
def run_command (OOOOO00O0OOO0000O ,O000OO00O00OOOOOO ):#line:69
|
| 28 |
+
print (f"Please wait, {O000OO00O00OOOOOO} is loading...")#line:70
|
| 29 |
+
subprocess .run (OOOOO00O0OOO0000O ,shell =True ,stdout =subprocess .DEVNULL ,stderr =subprocess .DEVNULL )#line:71
|
| 30 |
+
print (f"{O000OO00O00OOOOOO} ok!")#line:72
|
| 31 |
def zrok ():#line:75
|
| 32 |
try :#line:76
|
| 33 |
+
O0000OOOOOOO00O0O ="/home/studio-lab-user/.zrok/bin"#line:77
|
| 34 |
+
os .makedirs (O0000OOOOOOO00O0O ,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",O0000OOOOOOO00O0O ,"--wildcards","*zrok"],check =True )#line:80
|
| 37 |
os .remove ("zrok_0.4.23_linux_amd64.tar.gz")#line:81
|
| 38 |
+
except Exception as O0OOO0O00O00O00O0 :#line:83
|
| 39 |
+
print (f"An error occurred: {O0OOO0O00O00O00O0}")#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 OO0000OOO00OOO000 :#line:102
|
| 48 |
+
def OO0O0OO000O0OOOO0 (O0000O0OO00OOOO00 ,OO0000OOO000O00O0 ,OOO0O0O0000O0O0OO ):OOO0O00OOO0O00000 =widgets .Button (description =O0000O0OO00OOOO00 ,disabled =True ,button_style =OO0000OOO000O00O0 ,layout =widgets .Layout (min_width =OOO0O0O0000O0O0OO ));display (OOO0O00OOO0O00000 )#line:103
|
| 49 |
get_ipython ().system (f'git clone -q https://github.com/comfyanonymous/ComfyUI {wb}')#line:105
|
| 50 |
+
with capture .capture_output ()as OO0000OOO00OOO000 :#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
|
|
|
|
| 72 |
get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/pantat88/ui/resolve/main/4x_NMKD-Superscale-SP_178000_G.pth -d {wb}/models/upscale_models -o 4x_NMKD-Superscale-SP_178000_G.pth')#line:150
|
| 73 |
get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth -d {wb}/models/facerestore_models -o codeformer.pth')#line:152
|
| 74 |
get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://github.com/TencentARC/GFPGAN/releases/download/v1.3.4/GFPGANv1.4.pth -d {wb}/models/facerestore_models -o GFPGANv1.4.pth')#line:153
|
| 75 |
+
wise =" --dont-print-server --preview-method auto --use-pytorch-cross-attention"#line:155
|
| 76 |
ngrok_token =os .environ .get ('NGROK_TOKEN')#line:158
|
| 77 |
wise +=f" --ngrok {ngrok_token}"#line:159
|
| 78 |
+
def run (O00O0O00O0O000OO0 ):#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 {O00O0O00O0O000OO0} {wise}')#line:169
|
| 85 |
if os .path .exists (f'{wb}'):#line:172
|
| 86 |
run (f'main.py')#line:174
|
| 87 |
else :#line:175
|