Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
10421f93
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
12 个月 前同步成功
通知
1771
Star
81
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
体验新版 GitCode,发现更多精彩内容 >>
提交
10421f93
编写于
1月 26, 2023
作者:
B
brkirch
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix full previews, --no-half-vae
上级
6cff4401
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
5 addition
and
5 deletion
+5
-5
modules/processing.py
modules/processing.py
+4
-4
modules/sd_hijack_utils.py
modules/sd_hijack_utils.py
+1
-1
未找到文件。
modules/processing.py
浏览文件 @
10421f93
...
...
@@ -172,7 +172,7 @@ class StableDiffusionProcessing:
midas_in
=
torch
.
from_numpy
(
transformed
[
"midas_in"
][
None
,
...]).
to
(
device
=
shared
.
device
)
midas_in
=
repeat
(
midas_in
,
"1 ... -> n ..."
,
n
=
self
.
batch_size
)
conditioning_image
=
self
.
sd_model
.
get_first_stage_encoding
(
self
.
sd_model
.
encode_first_stage
(
source_image
.
to
(
devices
.
dtype_
unet
)
if
devices
.
unet_needs_upcast
else
source_image
))
conditioning_image
=
self
.
sd_model
.
get_first_stage_encoding
(
self
.
sd_model
.
encode_first_stage
(
source_image
.
to
(
devices
.
dtype_
vae
)
if
devices
.
unet_needs_upcast
else
source_image
))
conditioning_image
=
conditioning_image
.
float
()
if
devices
.
unet_needs_upcast
else
conditioning_image
conditioning
=
torch
.
nn
.
functional
.
interpolate
(
self
.
sd_model
.
depth_model
(
midas_in
),
...
...
@@ -217,7 +217,7 @@ class StableDiffusionProcessing:
)
# Encode the new masked image using first stage of network.
conditioning_image
=
self
.
sd_model
.
get_first_stage_encoding
(
self
.
sd_model
.
encode_first_stage
(
conditioning_image
.
to
(
devices
.
dtype_
unet
)
if
devices
.
unet_needs_upcast
else
conditioning_image
))
conditioning_image
=
self
.
sd_model
.
get_first_stage_encoding
(
self
.
sd_model
.
encode_first_stage
(
conditioning_image
.
to
(
devices
.
dtype_
vae
)
if
devices
.
unet_needs_upcast
else
conditioning_image
))
# Create the concatenated conditioning tensor to be fed to `c_concat`
conditioning_mask
=
torch
.
nn
.
functional
.
interpolate
(
conditioning_mask
,
size
=
latent_image
.
shape
[
-
2
:])
...
...
@@ -417,7 +417,7 @@ def create_random_tensors(shape, seeds, subseeds=None, subseed_strength=0.0, see
def
decode_first_stage
(
model
,
x
):
with
devices
.
autocast
(
disable
=
x
.
dtype
==
devices
.
dtype_vae
):
x
=
model
.
decode_first_stage
(
x
)
x
=
model
.
decode_first_stage
(
x
.
to
(
devices
.
dtype_vae
)
if
devices
.
unet_needs_upcast
else
x
)
return
x
...
...
@@ -1001,7 +1001,7 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
image
=
torch
.
from_numpy
(
batch_images
)
image
=
2.
*
image
-
1.
image
=
image
.
to
(
device
=
shared
.
device
,
dtype
=
devices
.
dtype_
unet
if
devices
.
unet_needs_upcast
else
None
)
image
=
image
.
to
(
device
=
shared
.
device
,
dtype
=
devices
.
dtype_
vae
if
devices
.
unet_needs_upcast
else
None
)
self
.
init_latent
=
self
.
sd_model
.
get_first_stage_encoding
(
self
.
sd_model
.
encode_first_stage
(
image
))
...
...
modules/sd_hijack_utils.py
浏览文件 @
10421f93
...
...
@@ -5,7 +5,7 @@ class CondFunc:
self
=
super
(
CondFunc
,
cls
).
__new__
(
cls
)
if
isinstance
(
orig_func
,
str
):
func_path
=
orig_func
.
split
(
'.'
)
for
i
in
range
(
len
(
func_path
)
-
2
,
-
1
,
-
1
):
for
i
in
range
(
len
(
func_path
)
-
1
,
-
1
,
-
1
):
try
:
resolved_obj
=
importlib
.
import_module
(
'.'
.
join
(
func_path
[:
i
]))
break
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录