Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
c0fb0c84
Commit
c0fb0c84
authored
Feb 25, 2023
by
comfyanonymous
Browse files
Update colab notebook.
parent
dfb397e0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
33 deletions
+39
-33
main.py
main.py
+8
-4
notebooks/comfyui_colab.ipynb
notebooks/comfyui_colab.ipynb
+27
-26
server.py
server.py
+4
-3
No files found.
main.py
View file @
c0fb0c84
...
@@ -383,8 +383,8 @@ class PromptQueue:
...
@@ -383,8 +383,8 @@ class PromptQueue:
with
self
.
mutex
:
with
self
.
mutex
:
self
.
history
.
pop
(
id_to_delete
,
None
)
self
.
history
.
pop
(
id_to_delete
,
None
)
async
def
run
(
server
,
address
=
''
,
port
=
8188
):
async
def
run
(
server
,
address
=
''
,
port
=
8188
,
verbose
=
True
):
await
asyncio
.
gather
(
server
.
start
(
address
,
port
),
server
.
publish_loop
())
await
asyncio
.
gather
(
server
.
start
(
address
,
port
,
verbose
),
server
.
publish_loop
())
def
hijack_progress
(
server
):
def
hijack_progress
(
server
):
from
tqdm.auto
import
tqdm
from
tqdm.auto
import
tqdm
...
@@ -410,6 +410,10 @@ if __name__ == "__main__":
...
@@ -410,6 +410,10 @@ if __name__ == "__main__":
else
:
else
:
address
=
'127.0.0.1'
address
=
'127.0.0.1'
dont_print
=
False
if
'--dont-print-server'
in
sys
.
argv
:
dont_print
=
True
port
=
8188
port
=
8188
try
:
try
:
p_index
=
sys
.
argv
.
index
(
'--port'
)
p_index
=
sys
.
argv
.
index
(
'--port'
)
...
@@ -419,9 +423,9 @@ if __name__ == "__main__":
...
@@ -419,9 +423,9 @@ if __name__ == "__main__":
if
os
.
name
==
"nt"
:
if
os
.
name
==
"nt"
:
try
:
try
:
loop
.
run_until_complete
(
run
(
server
,
address
=
address
,
port
=
port
))
loop
.
run_until_complete
(
run
(
server
,
address
=
address
,
port
=
port
,
verbose
=
not
dont_print
))
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
pass
pass
else
:
else
:
loop
.
run_until_complete
(
run
(
server
,
address
=
address
,
port
=
port
))
loop
.
run_until_complete
(
run
(
server
,
address
=
address
,
port
=
port
,
verbose
=
not
dont_print
))
notebooks/comfyui_colab.ipynb
View file @
c0fb0c84
...
@@ -36,7 +36,8 @@
...
@@ -36,7 +36,8 @@
"!git clone https://github.com/comfyanonymous/ComfyUI\n",
"!git clone https://github.com/comfyanonymous/ComfyUI\n",
"%cd ComfyUI\n",
"%cd ComfyUI\n",
"!pip install -r requirements.txt\n",
"!pip install -r requirements.txt\n",
"!pip install xformers"
"!pip install xformers\n",
"!sed -i 's/v1-inference.yaml/v1-inference_fp16.yaml/g' webshit/index.html"
]
]
},
},
{
{
...
@@ -86,20 +87,23 @@
...
@@ -86,20 +87,23 @@
{
{
"cell_type": "markdown",
"cell_type": "markdown",
"source": [
"source": [
"### Run ComfyUI \n",
"### Run ComfyUI with localtunnel\n",
"use the **fp16** model configs for more speed\n",
"\n",
"\n",
"
You should see the ui appear in an iframe. If you get a 403 error, it's your firefox settings or an extension that's messing things up
.\n",
"
If you have issues with the previous way, you can try this way. It will also work on non colab
.\n",
"\n",
"\n",
"If you want to open it in another window use the second link not the first one.\n"
"use the **fp16** model configs for more speed\n",
"\n"
],
],
"metadata": {
"metadata": {
"id": "
gggggggggg
"
"id": "
kkkkkkkkkkkkkk
"
}
}
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"source": [
"source": [
"!npm install -g localtunnel\n",
"\n",
"import subprocess\n",
"import threading\n",
"import threading\n",
"import time\n",
"import time\n",
"import socket\n",
"import socket\n",
...
@@ -111,17 +115,17 @@
...
@@ -111,17 +115,17 @@
" if result == 0:\n",
" if result == 0:\n",
" break\n",
" break\n",
" sock.close()\n",
" sock.close()\n",
"
from google.colab import output
\n",
"
p = subprocess.Popen([\"lt\", \"--port\", \"{}\".format(port)], stdout=subprocess.PIPE)
\n",
"
output.serve_kernel_port_as_iframe(port, height=1024)
\n",
"
for line in p.stdout:
\n",
" print(
\"to open it in a window you can open this link here:\"
)\n",
"
print(
line.decode(), end=''
)\n",
"
output.serve_kernel_port_as_window(port)
\n",
"\n",
"\n",
"\n",
"threading.Thread(target=iframe_thread, daemon=True, args=(8188,)).start()\n",
"threading.Thread(target=iframe_thread, daemon=True, args=(8188,)).start()\n",
"\n",
"\n",
"!python main.py --highvram"
"!python main.py --highvram
--dont-print-server
"
],
],
"metadata": {
"metadata": {
"id": "
hhhhhhhhhh
"
"id": "
jjjjjjjjjjjjj
"
},
},
"execution_count": null,
"execution_count": null,
"outputs": []
"outputs": []
...
@@ -129,23 +133,20 @@
...
@@ -129,23 +133,20 @@
{
{
"cell_type": "markdown",
"cell_type": "markdown",
"source": [
"source": [
"### Run ComfyUI with localtunnel\n",
"### Run ComfyUI with colab iframe (in case localtunnel doesn't work)\n",
"use the **fp16** model configs for more speed\n",
"\n",
"\n",
"
If you have issues with the previous way, you can try this way. It will also work on non colab
.\n",
"
You should see the ui appear in an iframe. If you get a 403 error, it's your firefox settings or an extension that's messing things up
.\n",
"\n",
"\n",
"use the **fp16** model configs for more speed\n",
"If you want to open it in another window use the link.\n"
"\n"
],
],
"metadata": {
"metadata": {
"id": "
kkkkkkkkkkkkkk
"
"id": "
gggggggggg
"
}
}
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"source": [
"source": [
"!npm install -g localtunnel\n",
"\n",
"import subprocess\n",
"import threading\n",
"import threading\n",
"import time\n",
"import time\n",
"import socket\n",
"import socket\n",
...
@@ -157,17 +158,17 @@
...
@@ -157,17 +158,17 @@
" if result == 0:\n",
" if result == 0:\n",
" break\n",
" break\n",
" sock.close()\n",
" sock.close()\n",
"
p = subprocess.Popen([\"lt\", \"--port\", \"{}\".format(port)], stdout=subprocess.PIPE)
\n",
"
from google.colab import output
\n",
"
for line in p.stdout:
\n",
"
output.serve_kernel_port_as_iframe(port, height=1024)
\n",
"
print(
line.decode(), end=''
)\n",
" print(
\"to open it in a window you can open this link here:\"
)\n",
"\n",
"
output.serve_kernel_port_as_window(port)
\n",
"\n",
"\n",
"threading.Thread(target=iframe_thread, daemon=True, args=(8188,)).start()\n",
"threading.Thread(target=iframe_thread, daemon=True, args=(8188,)).start()\n",
"\n",
"\n",
"!python main.py --highvram"
"!python main.py --highvram
--dont-print-server
"
],
],
"metadata": {
"metadata": {
"id": "
jjjjjjjjjjjjj
"
"id": "
hhhhhhhhhh
"
},
},
"execution_count": null,
"execution_count": null,
"outputs": []
"outputs": []
...
...
server.py
View file @
c0fb0c84
...
@@ -190,7 +190,7 @@ class PromptServer():
...
@@ -190,7 +190,7 @@ class PromptServer():
msg
=
await
self
.
messages
.
get
()
msg
=
await
self
.
messages
.
get
()
await
self
.
send
(
*
msg
)
await
self
.
send
(
*
msg
)
async
def
start
(
self
,
address
,
port
):
async
def
start
(
self
,
address
,
port
,
verbose
=
True
):
runner
=
web
.
AppRunner
(
self
.
app
)
runner
=
web
.
AppRunner
(
self
.
app
)
await
runner
.
setup
()
await
runner
.
setup
()
site
=
web
.
TCPSite
(
runner
,
address
,
port
)
site
=
web
.
TCPSite
(
runner
,
address
,
port
)
...
@@ -198,5 +198,6 @@ class PromptServer():
...
@@ -198,5 +198,6 @@ class PromptServer():
if
address
==
''
:
if
address
==
''
:
address
=
'0.0.0.0'
address
=
'0.0.0.0'
print
(
"Starting server
\n
"
)
if
verbose
:
print
(
"To see the GUI go to: http://{}:{}"
.
format
(
address
,
port
))
print
(
"Starting server
\n
"
)
print
(
"To see the GUI go to: http://{}:{}"
.
format
(
address
,
port
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment