Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
C
ComfyUI
管理
动态
成员
代码
仓库
分支
提交
标签
仓库图
比较修订版本
锁定的文件
部署
模型注册表
分析
模型实验
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
Show more breadcrumbs
hanamizuki
ComfyUI
提交
69cc75fb
提交
69cc75fb
编辑于
2年前
作者:
comfyanonymous
浏览文件
操作
下载
补丁
差异文件
Add a way to interrupt current processing in the backend.
上级
1e2c4df9
No related branches found
No related tags found
无相关合并请求
变更
5
隐藏空白变更内容
行内
左右并排
显示
5 个更改的文件
comfy/model_management.py
+28
-0
28 个添加, 0 个删除
comfy/model_management.py
comfy/samplers.py
+2
-0
2 个添加, 0 个删除
comfy/samplers.py
execution.py
+1
-0
1 个添加, 0 个删除
execution.py
nodes.py
+7
-0
7 个添加, 0 个删除
nodes.py
server.py
+6
-1
6 个添加, 1 个删除
server.py
有
44 个添加
和
1 个删除
comfy/model_management.py
+
28
−
0
浏览文件 @
69cc75fb
...
...
@@ -162,3 +162,31 @@ def maximum_batch_area():
memory_free
=
get_free_memory
()
/
(
1024
*
1024
)
area
=
((
memory_free
-
1024
)
*
0.9
)
/
(
0.6
)
return
int
(
max
(
area
,
0
))
#TODO: might be cleaner to put this somewhere else
import
threading
class
InterruptProcessingException
(
Exception
):
pass
interrupt_processing_mutex
=
threading
.
RLock
()
interrupt_processing
=
False
def
interrupt_current_processing
(
value
=
True
):
global
interrupt_processing
global
interrupt_processing_mutex
with
interrupt_processing_mutex
:
interrupt_processing
=
value
def
processing_interrupted
():
global
interrupt_processing
global
interrupt_processing_mutex
with
interrupt_processing_mutex
:
return
interrupt_processing
def
throw_exception_if_processing_interrupted
():
global
interrupt_processing
global
interrupt_processing_mutex
with
interrupt_processing_mutex
:
if
interrupt_processing
:
interrupt_processing
=
False
raise
InterruptProcessingException
()
This diff is collapsed.
点击以展开。
comfy/samplers.py
+
2
−
0
浏览文件 @
69cc75fb
...
...
@@ -172,6 +172,8 @@ def sampling_function(model_function, x, timestep, uncond, cond, cond_scale, con
output
=
model_function
(
input_x
,
timestep_
,
cond
=
c
).
chunk
(
batch_chunks
)
del
input_x
model_management
.
throw_exception_if_processing_interrupted
()
for
o
in
range
(
batch_chunks
):
if
cond_or_uncond
[
o
]
==
COND
:
out_cond
[:,:,
area
[
o
][
2
]:
area
[
o
][
0
]
+
area
[
o
][
2
],
area
[
o
][
3
]:
area
[
o
][
1
]
+
area
[
o
][
3
]]
+=
output
[
o
]
*
mult
[
o
]
...
...
This diff is collapsed.
点击以展开。
execution.py
+
1
−
0
浏览文件 @
69cc75fb
...
...
@@ -58,6 +58,7 @@ def recursive_execute(server, prompt, outputs, current_item, extra_data={}):
server
.
send_sync
(
"
executing
"
,
{
"
node
"
:
unique_id
},
server
.
client_id
)
obj
=
class_def
()
nodes
.
before_node_execution
()
outputs
[
unique_id
]
=
getattr
(
obj
,
obj
.
FUNCTION
)(
**
input_data_all
)
if
"
ui
"
in
outputs
[
unique_id
]
and
server
.
client_id
is
not
None
:
server
.
send_sync
(
"
executed
"
,
{
"
node
"
:
unique_id
,
"
output
"
:
outputs
[
unique_id
][
"
ui
"
]
},
server
.
client_id
)
...
...
This diff is collapsed.
点击以展开。
nodes.py
+
7
−
0
浏览文件 @
69cc75fb
...
...
@@ -41,6 +41,13 @@ def recursive_search(directory):
def
filter_files_extensions
(
files
,
extensions
):
return
sorted
(
list
(
filter
(
lambda
a
:
os
.
path
.
splitext
(
a
)[
-
1
].
lower
()
in
extensions
,
files
)))
def
before_node_execution
():
model_management
.
throw_exception_if_processing_interrupted
()
def
interrupt_processing
():
model_management
.
interrupt_current_processing
()
class
CLIPTextEncode
:
@classmethod
def
INPUT_TYPES
(
s
):
...
...
This diff is collapsed.
点击以展开。
server.py
+
6
−
1
浏览文件 @
69cc75fb
...
...
@@ -140,7 +140,12 @@ class PromptServer():
self
.
prompt_queue
.
delete_queue_item
(
delete_func
)
return
web
.
Response
(
status
=
200
)
@routes.post
(
"
/interrupt
"
)
async
def
post_interrupt
(
request
):
nodes
.
interrupt_processing
()
return
web
.
Response
(
status
=
200
)
@routes.post
(
"
/history
"
)
async
def
post_history
(
request
):
json_data
=
await
request
.
json
()
...
...
This diff is collapsed.
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录