Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sephuroth11
stable-diffusion-webui
提交
08c6f009
S
stable-diffusion-webui
项目概览
sephuroth11
/
stable-diffusion-webui
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
stable-diffusion-webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
08c6f009
编写于
1月 14, 2023
作者:
A
AUTOMATIC
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
load hashes from cache for checkpoints that have them
add checkpoint hash to footer
上级
febd2b72
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
48 addition
and
19 deletion
+48
-19
javascript/ui.js
javascript/ui.js
+16
-9
modules/hashes.py
modules/hashes.py
+19
-7
modules/sd_models.py
modules/sd_models.py
+6
-3
modules/shared.py
modules/shared.py
+1
-0
modules/ui.py
modules/ui.py
+2
-0
script.js
script.js
+4
-0
未找到文件。
javascript/ui.js
浏览文件 @
08c6f009
...
@@ -143,14 +143,6 @@ function confirm_clear_prompt(prompt, negative_prompt) {
...
@@ -143,14 +143,6 @@ function confirm_clear_prompt(prompt, negative_prompt) {
opts
=
{}
opts
=
{}
function
apply_settings
(
jsdata
){
console
.
log
(
jsdata
)
opts
=
JSON
.
parse
(
jsdata
)
return
jsdata
}
onUiUpdate
(
function
(){
onUiUpdate
(
function
(){
if
(
Object
.
keys
(
opts
).
length
!=
0
)
return
;
if
(
Object
.
keys
(
opts
).
length
!=
0
)
return
;
...
@@ -160,7 +152,7 @@ onUiUpdate(function(){
...
@@ -160,7 +152,7 @@ onUiUpdate(function(){
textarea
=
json_elem
.
querySelector
(
'
textarea
'
)
textarea
=
json_elem
.
querySelector
(
'
textarea
'
)
jsdata
=
textarea
.
value
jsdata
=
textarea
.
value
opts
=
JSON
.
parse
(
jsdata
)
opts
=
JSON
.
parse
(
jsdata
)
executeCallbacks
(
optionsChangedCallbacks
);
Object
.
defineProperty
(
textarea
,
'
value
'
,
{
Object
.
defineProperty
(
textarea
,
'
value
'
,
{
set
:
function
(
newValue
)
{
set
:
function
(
newValue
)
{
...
@@ -171,6 +163,8 @@ onUiUpdate(function(){
...
@@ -171,6 +163,8 @@ onUiUpdate(function(){
if
(
oldValue
!=
newValue
)
{
if
(
oldValue
!=
newValue
)
{
opts
=
JSON
.
parse
(
textarea
.
value
)
opts
=
JSON
.
parse
(
textarea
.
value
)
}
}
executeCallbacks
(
optionsChangedCallbacks
);
},
},
get
:
function
()
{
get
:
function
()
{
var
valueProp
=
Object
.
getOwnPropertyDescriptor
(
HTMLTextAreaElement
.
prototype
,
'
value
'
);
var
valueProp
=
Object
.
getOwnPropertyDescriptor
(
HTMLTextAreaElement
.
prototype
,
'
value
'
);
...
@@ -201,6 +195,19 @@ onUiUpdate(function(){
...
@@ -201,6 +195,19 @@ onUiUpdate(function(){
}
}
})
})
onOptionsChanged
(
function
(){
elem
=
gradioApp
().
getElementById
(
'
sd_checkpoint_hash
'
)
sd_checkpoint_hash
=
opts
.
sd_checkpoint_hash
||
""
shorthash
=
sd_checkpoint_hash
.
substr
(
0
,
10
)
if
(
elem
&&
elem
.
textContent
!=
shorthash
){
elem
.
textContent
=
shorthash
elem
.
title
=
sd_checkpoint_hash
elem
.
href
=
"
https://google.com/search?q=
"
+
sd_checkpoint_hash
}
})
let
txt2img_textarea
,
img2img_textarea
=
undefined
;
let
txt2img_textarea
,
img2img_textarea
=
undefined
;
let
wait_time
=
800
let
wait_time
=
800
let
token_timeout
;
let
token_timeout
;
...
...
modules/hashes.py
浏览文件 @
08c6f009
...
@@ -42,23 +42,35 @@ def calculate_sha256(filename):
...
@@ -42,23 +42,35 @@ def calculate_sha256(filename):
return
hash_sha256
.
hexdigest
()
return
hash_sha256
.
hexdigest
()
def
sha256
(
filename
,
title
):
def
sha256
_from_cache
(
filename
,
title
):
hashes
=
cache
(
"hashes"
)
hashes
=
cache
(
"hashes"
)
ondisk_mtime
=
os
.
path
.
getmtime
(
filename
)
ondisk_mtime
=
os
.
path
.
getmtime
(
filename
)
if
title
in
hashes
:
if
title
not
in
hashes
:
cached_sha256
=
hashes
[
title
].
get
(
"sha256"
,
None
)
return
None
cached_mtime
=
hashes
[
title
].
get
(
"mtime"
,
0
)
cached_sha256
=
hashes
[
title
].
get
(
"sha256"
,
None
)
cached_mtime
=
hashes
[
title
].
get
(
"mtime"
,
0
)
if
ondisk_mtime
>
cached_mtime
or
cached_sha256
is
None
:
return
None
return
cached_sha256
def
sha256
(
filename
,
title
):
hashes
=
cache
(
"hashes"
)
if
ondisk_mtime
<=
cached_mtime
and
cached_sha256
is
not
None
:
sha256_value
=
sha256_from_cache
(
filename
,
title
)
return
cached_sha256
if
sha256_value
is
not
None
:
return
sha256_value
print
(
f
"Calculating sha256 for
{
filename
}
: "
,
end
=
''
)
print
(
f
"Calculating sha256 for
{
filename
}
: "
,
end
=
''
)
sha256_value
=
calculate_sha256
(
filename
)
sha256_value
=
calculate_sha256
(
filename
)
print
(
f
"
{
sha256_value
}
"
)
print
(
f
"
{
sha256_value
}
"
)
hashes
[
title
]
=
{
hashes
[
title
]
=
{
"mtime"
:
o
ndisk_mtime
,
"mtime"
:
o
s
.
path
.
getmtime
(
filename
)
,
"sha256"
:
sha256_value
,
"sha256"
:
sha256_value
,
}
}
...
...
modules/sd_models.py
浏览文件 @
08c6f009
...
@@ -44,9 +44,11 @@ class CheckpointInfo:
...
@@ -44,9 +44,11 @@ class CheckpointInfo:
self
.
title
=
name
self
.
title
=
name
self
.
model_name
=
os
.
path
.
splitext
(
name
.
replace
(
"/"
,
"_"
).
replace
(
"
\\
"
,
"_"
))[
0
]
self
.
model_name
=
os
.
path
.
splitext
(
name
.
replace
(
"/"
,
"_"
).
replace
(
"
\\
"
,
"_"
))[
0
]
self
.
hash
=
model_hash
(
filename
)
self
.
hash
=
model_hash
(
filename
)
self
.
ids
=
[
self
.
hash
,
self
.
model_name
,
self
.
title
,
f
'
{
name
}
[
{
self
.
hash
}
]'
]
self
.
shorthash
=
None
self
.
sha256
=
hashes
.
sha256_from_cache
(
self
.
filename
,
"checkpoint/"
+
self
.
title
)
self
.
sha256
=
None
self
.
shorthash
=
self
.
sha256
[
0
:
10
]
if
self
.
sha256
else
None
self
.
ids
=
[
self
.
hash
,
self
.
model_name
,
self
.
title
,
f
'
{
name
}
[
{
self
.
hash
}
]'
]
+
([
self
.
shorthash
,
self
.
sha256
]
if
self
.
shorthash
else
[])
def
register
(
self
):
def
register
(
self
):
checkpoints_list
[
self
.
title
]
=
self
checkpoints_list
[
self
.
title
]
=
self
...
@@ -269,6 +271,7 @@ def load_model_weights(model, checkpoint_info: CheckpointInfo, vae_file="auto"):
...
@@ -269,6 +271,7 @@ def load_model_weights(model, checkpoint_info: CheckpointInfo, vae_file="auto"):
model
.
sd_model_hash
=
sd_model_hash
model
.
sd_model_hash
=
sd_model_hash
model
.
sd_model_checkpoint
=
checkpoint_info
.
filename
model
.
sd_model_checkpoint
=
checkpoint_info
.
filename
model
.
sd_checkpoint_info
=
checkpoint_info
model
.
sd_checkpoint_info
=
checkpoint_info
shared
.
opts
.
data
[
"sd_checkpoint_hash"
]
=
checkpoint_info
.
sha256
model
.
logvar
=
model
.
logvar
.
to
(
devices
.
device
)
# fix for training
model
.
logvar
=
model
.
logvar
.
to
(
devices
.
device
)
# fix for training
...
...
modules/shared.py
浏览文件 @
08c6f009
...
@@ -458,6 +458,7 @@ options_templates.update(options_section(('sampler-params', "Sampler parameters"
...
@@ -458,6 +458,7 @@ options_templates.update(options_section(('sampler-params', "Sampler parameters"
options_templates
.
update
(
options_section
((
None
,
"Hidden options"
),
{
options_templates
.
update
(
options_section
((
None
,
"Hidden options"
),
{
"disabled_extensions"
:
OptionInfo
([],
"Disable those extensions"
),
"disabled_extensions"
:
OptionInfo
([],
"Disable those extensions"
),
"sd_checkpoint_hash"
:
OptionInfo
(
""
,
"SHA256 hash of the current checkpoint"
),
}))
}))
options_templates
.
update
()
options_templates
.
update
()
...
...
modules/ui.py
浏览文件 @
08c6f009
...
@@ -1841,4 +1841,6 @@ xformers: {xformers_version}
...
@@ -1841,4 +1841,6 @@ xformers: {xformers_version}
gradio:
{
gr
.
__version__
}
gradio:
{
gr
.
__version__
}
•
•
commit: <a href="https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/
{
commit
}
">
{
short_commit
}
</a>
commit: <a href="https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/
{
commit
}
">
{
short_commit
}
</a>
•
checkpoint: <a id="sd_checkpoint_hash">N/A</a>
"""
"""
script.js
浏览文件 @
08c6f009
...
@@ -14,6 +14,7 @@ function get_uiCurrentTabContent() {
...
@@ -14,6 +14,7 @@ function get_uiCurrentTabContent() {
uiUpdateCallbacks
=
[]
uiUpdateCallbacks
=
[]
uiTabChangeCallbacks
=
[]
uiTabChangeCallbacks
=
[]
optionsChangedCallbacks
=
[]
let
uiCurrentTab
=
null
let
uiCurrentTab
=
null
function
onUiUpdate
(
callback
){
function
onUiUpdate
(
callback
){
...
@@ -22,6 +23,9 @@ function onUiUpdate(callback){
...
@@ -22,6 +23,9 @@ function onUiUpdate(callback){
function
onUiTabChange
(
callback
){
function
onUiTabChange
(
callback
){
uiTabChangeCallbacks
.
push
(
callback
)
uiTabChangeCallbacks
.
push
(
callback
)
}
}
function
onOptionsChanged
(
callback
){
optionsChangedCallbacks
.
push
(
callback
)
}
function
runCallback
(
x
,
m
){
function
runCallback
(
x
,
m
){
try
{
try
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录