Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
C
ComfyUI
管理
动态
成员
代码
仓库
分支
提交
标签
仓库图
比较修订版本
锁定的文件
部署
模型注册表
分析
模型实验
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
Show more breadcrumbs
hanamizuki
ComfyUI
提交
dd5b57e3
未验证
提交
dd5b57e3
编辑于
4个月前
作者:
DenOfEquity
提交者:
GitHub
4个月前
浏览文件
操作
下载
补丁
差异文件
fix for SAG with Kohya HRFix/ Deep Shrink (#5546)
now works with arbitrary downscale factors
上级
75a818c7
No related branches found
分支 包含提交
No related tags found
标签 包含提交
无相关合并请求
变更
1
隐藏空白变更内容
行内
左右并排
显示
1 个更改的文件
comfy_extras/nodes_sag.py
+8
-3
8 个添加, 3 个删除
comfy_extras/nodes_sag.py
有
8 个添加
和
3 个删除
comfy_extras/nodes_sag.py
+
8
−
3
浏览文件 @
dd5b57e3
...
...
@@ -57,12 +57,17 @@ def create_blur_map(x0, attn, sigma=3.0, threshold=1.0):
attn
=
attn
.
reshape
(
b
,
-
1
,
hw1
,
hw2
)
# Global Average Pool
mask
=
attn
.
mean
(
1
,
keepdim
=
False
).
sum
(
1
,
keepdim
=
False
)
>
threshold
ratio
=
2
**
(
math
.
ceil
(
math
.
sqrt
(
lh
*
lw
/
hw1
))
-
1
).
bit_length
()
mid_shape
=
[
math
.
ceil
(
lh
/
ratio
),
math
.
ceil
(
lw
/
ratio
)]
f
=
float
(
lh
)
/
float
(
lw
)
fh
=
f
**
0.5
fw
=
(
1
/
f
)
**
0.5
S
=
mask
.
size
(
1
)
**
0.5
w
=
int
(
0.5
+
S
*
fw
)
h
=
int
(
0.5
+
S
*
fh
)
# Reshape
mask
=
(
mask
.
reshape
(
b
,
*
mid_shape
)
mask
.
reshape
(
b
,
h
,
w
)
.
unsqueeze
(
1
)
.
type
(
attn
.
dtype
)
)
...
...
This diff is collapsed.
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录