Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
ae17e978
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
10 个月 前同步成功
通知
1747
Star
81
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
ae17e978
编写于
5月 11, 2023
作者:
S
Sakura-Luna
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
UniPC progress bar adjustment
上级
22bcc7be
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
33 deletion
+37
-33
modules/models/diffusion/uni_pc/uni_pc.py
modules/models/diffusion/uni_pc/uni_pc.py
+37
-33
未找到文件。
modules/models/diffusion/uni_pc/uni_pc.py
浏览文件 @
ae17e978
import
torch
import
torch.nn.functional
as
F
import
math
from
tqdm.auto
import
trange
import
tqdm
class
NoiseScheduleVP
:
...
...
@@ -757,40 +757,44 @@ class UniPC:
vec_t
=
timesteps
[
0
].
expand
((
x
.
shape
[
0
]))
model_prev_list
=
[
self
.
model_fn
(
x
,
vec_t
)]
t_prev_list
=
[
vec_t
]
# Init the first `order` values by lower order multistep DPM-Solver.
for
init_order
in
range
(
1
,
order
):
vec_t
=
timesteps
[
init_order
].
expand
(
x
.
shape
[
0
])
x
,
model_x
=
self
.
multistep_uni_pc_update
(
x
,
model_prev_list
,
t_prev_list
,
vec_t
,
init_order
,
use_corrector
=
True
)
if
model_x
is
None
:
model_x
=
self
.
model_fn
(
x
,
vec_t
)
if
self
.
after_update
is
not
None
:
self
.
after_update
(
x
,
model_x
)
model_prev_list
.
append
(
model_x
)
t_prev_list
.
append
(
vec_t
)
for
step
in
trange
(
order
,
steps
+
1
):
vec_t
=
timesteps
[
step
].
expand
(
x
.
shape
[
0
])
if
lower_order_final
:
step_order
=
min
(
order
,
steps
+
1
-
step
)
else
:
step_order
=
order
#print('this step order:', step_order)
if
step
==
steps
:
#print('do not run corrector at the last step')
use_corrector
=
False
else
:
use_corrector
=
True
x
,
model_x
=
self
.
multistep_uni_pc_update
(
x
,
model_prev_list
,
t_prev_list
,
vec_t
,
step_order
,
use_corrector
=
use_corrector
)
if
self
.
after_update
is
not
None
:
self
.
after_update
(
x
,
model_x
)
for
i
in
range
(
order
-
1
):
t_prev_list
[
i
]
=
t_prev_list
[
i
+
1
]
model_prev_list
[
i
]
=
model_prev_list
[
i
+
1
]
t_prev_list
[
-
1
]
=
vec_t
# We do not need to evaluate the final model value.
if
step
<
steps
:
with
tqdm
.
tqdm
(
total
=
steps
)
as
pbar
:
# Init the first `order` values by lower order multistep DPM-Solver.
for
init_order
in
range
(
1
,
order
):
vec_t
=
timesteps
[
init_order
].
expand
(
x
.
shape
[
0
])
x
,
model_x
=
self
.
multistep_uni_pc_update
(
x
,
model_prev_list
,
t_prev_list
,
vec_t
,
init_order
,
use_corrector
=
True
)
if
model_x
is
None
:
model_x
=
self
.
model_fn
(
x
,
vec_t
)
model_prev_list
[
-
1
]
=
model_x
if
self
.
after_update
is
not
None
:
self
.
after_update
(
x
,
model_x
)
model_prev_list
.
append
(
model_x
)
t_prev_list
.
append
(
vec_t
)
pbar
.
update
()
for
step
in
range
(
order
,
steps
+
1
):
vec_t
=
timesteps
[
step
].
expand
(
x
.
shape
[
0
])
if
lower_order_final
:
step_order
=
min
(
order
,
steps
+
1
-
step
)
else
:
step_order
=
order
#print('this step order:', step_order)
if
step
==
steps
:
#print('do not run corrector at the last step')
use_corrector
=
False
else
:
use_corrector
=
True
x
,
model_x
=
self
.
multistep_uni_pc_update
(
x
,
model_prev_list
,
t_prev_list
,
vec_t
,
step_order
,
use_corrector
=
use_corrector
)
if
self
.
after_update
is
not
None
:
self
.
after_update
(
x
,
model_x
)
for
i
in
range
(
order
-
1
):
t_prev_list
[
i
]
=
t_prev_list
[
i
+
1
]
model_prev_list
[
i
]
=
model_prev_list
[
i
+
1
]
t_prev_list
[
-
1
]
=
vec_t
# We do not need to evaluate the final model value.
if
step
<
steps
:
if
model_x
is
None
:
model_x
=
self
.
model_fn
(
x
,
vec_t
)
model_prev_list
[
-
1
]
=
model_x
pbar
.
update
()
else
:
raise
NotImplementedError
()
if
denoise_to_zero
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录