Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
5159edbf
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
11 个月 前同步成功
通知
1771
Star
81
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
体验新版 GitCode,发现更多精彩内容 >>
提交
5159edbf
编写于
8月 20, 2023
作者:
U
Uminosachi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Store base_vae and loaded_vae_file in sd_model
上级
042e1d5d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
8 addition
and
16 deletion
+8
-16
modules/sd_models.py
modules/sd_models.py
+8
-16
未找到文件。
modules/sd_models.py
浏览文件 @
5159edbf
...
...
@@ -462,7 +462,6 @@ class SdModelData:
def
__init__
(
self
):
self
.
sd_model
=
None
self
.
loaded_sd_models
=
[]
self
.
loaded_vae_states
=
{}
self
.
was_loaded_at_least_once
=
False
self
.
lock
=
threading
.
Lock
()
...
...
@@ -489,24 +488,19 @@ class SdModelData:
def
set_sd_model
(
self
,
v
,
already_loaded
=
False
):
self
.
sd_model
=
v
if
already_loaded
:
sd_vae_state
=
self
.
loaded_vae_states
.
get
(
v
.
sd_model_hash
,
{})
sd_vae
.
base_vae
=
sd_vae_state
.
get
(
"base_vae"
,
None
)
sd_vae
.
loaded_vae_file
=
sd_vae_state
.
get
(
"loaded_vae_file"
,
None
)
sd_vae
.
checkpoint_info
=
sd_vae_state
.
get
(
"checkpoint_info"
,
None
)
sd_vae
.
base_vae
=
getattr
(
v
,
"base_vae"
,
None
)
sd_vae
.
loaded_vae_file
=
getattr
(
v
,
"loaded_vae_file"
,
None
)
sd_vae
.
checkpoint_info
=
v
.
sd_checkpoint_info
try
:
self
.
loaded_sd_models
.
remove
(
v
)
self
.
loaded_vae_states
.
pop
(
v
.
sd_model_hash
,
{}).
clear
()
except
ValueError
:
pass
if
v
is
not
None
:
setattr
(
v
,
"base_vae"
,
sd_vae
.
base_vae
)
setattr
(
v
,
"loaded_vae_file"
,
sd_vae
.
loaded_vae_file
)
self
.
loaded_sd_models
.
insert
(
0
,
v
)
self
.
loaded_vae_states
[
v
.
sd_model_hash
]
=
dict
(
base_vae
=
sd_vae
.
base_vae
,
loaded_vae_file
=
sd_vae
.
loaded_vae_file
,
checkpoint_info
=
sd_vae
.
checkpoint_info
,
)
model_data
=
SdModelData
()
...
...
@@ -661,7 +655,6 @@ def reuse_model_from_already_loaded(sd_model, checkpoint_info, timer):
if
len
(
model_data
.
loaded_sd_models
)
>
shared
.
opts
.
sd_checkpoints_limit
>
0
:
print
(
f
"Unloading model
{
len
(
model_data
.
loaded_sd_models
)
}
over the limit of
{
shared
.
opts
.
sd_checkpoints_limit
}
:
{
loaded_model
.
sd_checkpoint_info
.
title
}
"
)
model_data
.
loaded_sd_models
.
pop
()
model_data
.
loaded_vae_states
.
pop
(
loaded_model
.
sd_model_hash
,
{}).
clear
()
send_model_to_trash
(
loaded_model
)
timer
.
record
(
"send model to trash"
)
...
...
@@ -691,10 +684,9 @@ def reuse_model_from_already_loaded(sd_model, checkpoint_info, timer):
sd_model
=
model_data
.
loaded_sd_models
.
pop
()
model_data
.
sd_model
=
sd_model
sd_vae_state
=
model_data
.
loaded_vae_states
.
pop
(
sd_model
.
sd_model_hash
,
{})
sd_vae
.
base_vae
=
sd_vae_state
.
get
(
"base_vae"
,
None
)
sd_vae
.
loaded_vae_file
=
sd_vae_state
.
get
(
"loaded_vae_file"
,
None
)
sd_vae
.
checkpoint_info
=
sd_vae_state
.
get
(
"checkpoint_info"
,
None
)
sd_vae
.
base_vae
=
getattr
(
sd_model
,
"base_vae"
,
None
)
sd_vae
.
loaded_vae_file
=
getattr
(
sd_model
,
"loaded_vae_file"
,
None
)
sd_vae
.
checkpoint_info
=
sd_model
.
sd_checkpoint_info
print
(
f
"Reusing loaded model
{
sd_model
.
sd_checkpoint_info
.
title
}
to load
{
checkpoint_info
.
title
}
"
)
return
sd_model
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录