Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
C
ComfyUI
管理
动态
成员
代码
仓库
分支
提交
标签
仓库图
比较修订版本
锁定的文件
部署
模型注册表
分析
模型实验
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
Show more breadcrumbs
hanamizuki
ComfyUI
提交
9aac21f8
提交
9aac21f8
编辑于
5天前
作者:
comfyanonymous
浏览文件
操作
下载
补丁
差异文件
Fix issues with new hunyuan img2vid model and bumb version to v0.3.26
上级
528d1b35
分支
ignore_fe_package
分支 包含提交
No related tags found
无相关合并请求
变更
4
隐藏空白变更内容
行内
左右并排
显示
4 个更改的文件
comfy/ldm/flux/layers.py
+7
-7
7 个添加, 7 个删除
comfy/ldm/flux/layers.py
comfy/ldm/hunyuan_video/model.py
+7
-5
7 个添加, 5 个删除
comfy/ldm/hunyuan_video/model.py
comfyui_version.py
+1
-1
1 个添加, 1 个删除
comfyui_version.py
pyproject.toml
+1
-1
1 个添加, 1 个删除
pyproject.toml
有
16 个添加
和
14 个删除
comfy/ldm/flux/layers.py
+
7
−
7
浏览文件 @
9aac21f8
...
...
@@ -159,20 +159,20 @@ class DoubleStreamBlock(nn.Module):
)
self
.
flipped_img_txt
=
flipped_img_txt
def
forward
(
self
,
img
:
Tensor
,
txt
:
Tensor
,
vec
:
Tensor
,
pe
:
Tensor
,
attn_mask
=
None
,
modulation_dims
=
None
):
def
forward
(
self
,
img
:
Tensor
,
txt
:
Tensor
,
vec
:
Tensor
,
pe
:
Tensor
,
attn_mask
=
None
,
modulation_dims
_img
=
None
,
modulation_dims_txt
=
None
):
img_mod1
,
img_mod2
=
self
.
img_mod
(
vec
)
txt_mod1
,
txt_mod2
=
self
.
txt_mod
(
vec
)
# prepare image for attention
img_modulated
=
self
.
img_norm1
(
img
)
img_modulated
=
apply_mod
(
img_modulated
,
(
1
+
img_mod1
.
scale
),
img_mod1
.
shift
,
modulation_dims
)
img_modulated
=
apply_mod
(
img_modulated
,
(
1
+
img_mod1
.
scale
),
img_mod1
.
shift
,
modulation_dims
_img
)
img_qkv
=
self
.
img_attn
.
qkv
(
img_modulated
)
img_q
,
img_k
,
img_v
=
img_qkv
.
view
(
img_qkv
.
shape
[
0
],
img_qkv
.
shape
[
1
],
3
,
self
.
num_heads
,
-
1
).
permute
(
2
,
0
,
3
,
1
,
4
)
img_q
,
img_k
=
self
.
img_attn
.
norm
(
img_q
,
img_k
,
img_v
)
# prepare txt for attention
txt_modulated
=
self
.
txt_norm1
(
txt
)
txt_modulated
=
apply_mod
(
txt_modulated
,
(
1
+
txt_mod1
.
scale
),
txt_mod1
.
shift
,
modulation_dims
)
txt_modulated
=
apply_mod
(
txt_modulated
,
(
1
+
txt_mod1
.
scale
),
txt_mod1
.
shift
,
modulation_dims
_txt
)
txt_qkv
=
self
.
txt_attn
.
qkv
(
txt_modulated
)
txt_q
,
txt_k
,
txt_v
=
txt_qkv
.
view
(
txt_qkv
.
shape
[
0
],
txt_qkv
.
shape
[
1
],
3
,
self
.
num_heads
,
-
1
).
permute
(
2
,
0
,
3
,
1
,
4
)
txt_q
,
txt_k
=
self
.
txt_attn
.
norm
(
txt_q
,
txt_k
,
txt_v
)
...
...
@@ -195,12 +195,12 @@ class DoubleStreamBlock(nn.Module):
txt_attn
,
img_attn
=
attn
[:,
:
txt
.
shape
[
1
]],
attn
[:,
txt
.
shape
[
1
]:]
# calculate the img bloks
img
=
img
+
apply_mod
(
self
.
img_attn
.
proj
(
img_attn
),
img_mod1
.
gate
,
None
,
modulation_dims
)
img
=
img
+
apply_mod
(
self
.
img_mlp
(
apply_mod
(
self
.
img_norm2
(
img
),
(
1
+
img_mod2
.
scale
),
img_mod2
.
shift
,
modulation_dims
)),
img_mod2
.
gate
,
None
,
modulation_dims
)
img
=
img
+
apply_mod
(
self
.
img_attn
.
proj
(
img_attn
),
img_mod1
.
gate
,
None
,
modulation_dims
_img
)
img
=
img
+
apply_mod
(
self
.
img_mlp
(
apply_mod
(
self
.
img_norm2
(
img
),
(
1
+
img_mod2
.
scale
),
img_mod2
.
shift
,
modulation_dims
_img
)),
img_mod2
.
gate
,
None
,
modulation_dims
_img
)
# calculate the txt bloks
txt
+=
apply_mod
(
self
.
txt_attn
.
proj
(
txt_attn
),
txt_mod1
.
gate
,
None
,
modulation_dims
)
txt
+=
apply_mod
(
self
.
txt_mlp
(
apply_mod
(
self
.
txt_norm2
(
txt
),
(
1
+
txt_mod2
.
scale
),
txt_mod2
.
shift
,
modulation_dims
)),
txt_mod2
.
gate
,
None
,
modulation_dims
)
txt
+=
apply_mod
(
self
.
txt_attn
.
proj
(
txt_attn
),
txt_mod1
.
gate
,
None
,
modulation_dims
_txt
)
txt
+=
apply_mod
(
self
.
txt_mlp
(
apply_mod
(
self
.
txt_norm2
(
txt
),
(
1
+
txt_mod2
.
scale
),
txt_mod2
.
shift
,
modulation_dims
_txt
)),
txt_mod2
.
gate
,
None
,
modulation_dims
_txt
)
if
txt
.
dtype
==
torch
.
float16
:
txt
=
torch
.
nan_to_num
(
txt
,
nan
=
0.0
,
posinf
=
65504
,
neginf
=-
65504
)
...
...
This diff is collapsed.
点击以展开。
comfy/ldm/hunyuan_video/model.py
+
7
−
5
浏览文件 @
9aac21f8
...
...
@@ -244,9 +244,11 @@ class HunyuanVideo(nn.Module):
vec
=
torch
.
cat
([(
vec_
+
token_replace_vec
).
unsqueeze
(
1
),
(
vec_
+
vec
).
unsqueeze
(
1
)],
dim
=
1
)
frame_tokens
=
(
initial_shape
[
-
1
]
//
self
.
patch_size
[
-
1
])
*
(
initial_shape
[
-
2
]
//
self
.
patch_size
[
-
2
])
modulation_dims
=
[(
0
,
frame_tokens
,
0
),
(
frame_tokens
,
None
,
1
)]
modulation_dims_txt
=
[(
0
,
None
,
1
)]
else
:
vec
=
vec
+
self
.
vector_in
(
y
[:,
:
self
.
params
.
vec_in_dim
])
modulation_dims
=
None
modulation_dims_txt
=
None
if
self
.
params
.
guidance_embed
:
if
guidance
is
not
None
:
...
...
@@ -273,14 +275,14 @@ class HunyuanVideo(nn.Module):
if
(
"
double_block
"
,
i
)
in
blocks_replace
:
def
block_wrap
(
args
):
out
=
{}
out
[
"
img
"
],
out
[
"
txt
"
]
=
block
(
img
=
args
[
"
img
"
],
txt
=
args
[
"
txt
"
],
vec
=
args
[
"
vec
"
],
pe
=
args
[
"
pe
"
],
attn_mask
=
args
[
"
attention_mask
"
])
out
[
"
img
"
],
out
[
"
txt
"
]
=
block
(
img
=
args
[
"
img
"
],
txt
=
args
[
"
txt
"
],
vec
=
args
[
"
vec
"
],
pe
=
args
[
"
pe
"
],
attn_mask
=
args
[
"
attention_mask
"
]
,
modulation_dims_img
=
args
[
"
modulation_dims_img
"
],
modulation_dims_txt
=
args
[
"
modulation_dims_txt
"
]
)
return
out
out
=
blocks_replace
[(
"
double_block
"
,
i
)]({
"
img
"
:
img
,
"
txt
"
:
txt
,
"
vec
"
:
vec
,
"
pe
"
:
pe
,
"
attention_mask
"
:
attn_mask
},
{
"
original_block
"
:
block_wrap
})
out
=
blocks_replace
[(
"
double_block
"
,
i
)]({
"
img
"
:
img
,
"
txt
"
:
txt
,
"
vec
"
:
vec
,
"
pe
"
:
pe
,
"
attention_mask
"
:
attn_mask
,
'
modulation_dims_img
'
:
modulation_dims
,
'
modulation_dims_txt
'
:
modulation_dims_txt
},
{
"
original_block
"
:
block_wrap
})
txt
=
out
[
"
txt
"
]
img
=
out
[
"
img
"
]
else
:
img
,
txt
=
block
(
img
=
img
,
txt
=
txt
,
vec
=
vec
,
pe
=
pe
,
attn_mask
=
attn_mask
,
modulation_dims
=
modulation_dims
)
img
,
txt
=
block
(
img
=
img
,
txt
=
txt
,
vec
=
vec
,
pe
=
pe
,
attn_mask
=
attn_mask
,
modulation_dims
_img
=
modulation_dims
,
modulation_dims_txt
=
modulation_dims_txt
)
if
control
is
not
None
:
# Controlnet
control_i
=
control
.
get
(
"
input
"
)
...
...
@@ -295,10 +297,10 @@ class HunyuanVideo(nn.Module):
if
(
"
single_block
"
,
i
)
in
blocks_replace
:
def
block_wrap
(
args
):
out
=
{}
out
[
"
img
"
]
=
block
(
args
[
"
img
"
],
vec
=
args
[
"
vec
"
],
pe
=
args
[
"
pe
"
],
attn_mask
=
args
[
"
attention_mask
"
])
out
[
"
img
"
]
=
block
(
args
[
"
img
"
],
vec
=
args
[
"
vec
"
],
pe
=
args
[
"
pe
"
],
attn_mask
=
args
[
"
attention_mask
"
]
,
modulation_dims
=
args
[
"
modulation_dims
"
]
)
return
out
out
=
blocks_replace
[(
"
single_block
"
,
i
)]({
"
img
"
:
img
,
"
vec
"
:
vec
,
"
pe
"
:
pe
,
"
attention_mask
"
:
attn_mask
},
{
"
original_block
"
:
block_wrap
})
out
=
blocks_replace
[(
"
single_block
"
,
i
)]({
"
img
"
:
img
,
"
vec
"
:
vec
,
"
pe
"
:
pe
,
"
attention_mask
"
:
attn_mask
,
'
modulation_dims
'
:
modulation_dims
},
{
"
original_block
"
:
block_wrap
})
img
=
out
[
"
img
"
]
else
:
img
=
block
(
img
,
vec
=
vec
,
pe
=
pe
,
attn_mask
=
attn_mask
,
modulation_dims
=
modulation_dims
)
...
...
This diff is collapsed.
点击以展开。
comfyui_version.py
+
1
−
1
浏览文件 @
9aac21f8
# This file is automatically generated by the build process when version is
# updated in pyproject.toml.
__version__
=
"
0.3.2
5
"
__version__
=
"
0.3.2
6
"
This diff is collapsed.
点击以展开。
pyproject.toml
+
1
−
1
浏览文件 @
9aac21f8
[project]
name
=
"ComfyUI"
version
=
"0.3.2
5
"
version
=
"0.3.2
6
"
readme
=
"README.md"
license
=
{
file
=
"LICENSE"
}
requires-python
=
">
=
3.9
"
...
...
This diff is collapsed.
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录