Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
44c27ebc
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
10 个月 前同步成功
通知
1735
Star
81
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
44c27ebc
编写于
7月 10, 2023
作者:
A
Aarni Koskela
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use closing() with processing classes everywhere
Follows up on #11569
上级
bcb6ad5f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
19 deletion
+24
-19
modules/hypernetworks/hypernetwork.py
modules/hypernetworks/hypernetwork.py
+4
-2
modules/img2img.py
modules/img2img.py
+10
-10
modules/textual_inversion/textual_inversion.py
modules/textual_inversion/textual_inversion.py
+4
-2
modules/txt2img.py
modules/txt2img.py
+6
-5
未找到文件。
modules/hypernetworks/hypernetwork.py
浏览文件 @
44c27ebc
...
...
@@ -3,6 +3,7 @@ import glob
import
html
import
os
import
inspect
from
contextlib
import
closing
import
modules.textual_inversion.dataset
import
torch
...
...
@@ -711,8 +712,9 @@ def train_hypernetwork(id_task, hypernetwork_name, learn_rate, batch_size, gradi
preview_text
=
p
.
prompt
processed
=
processing
.
process_images
(
p
)
image
=
processed
.
images
[
0
]
if
len
(
processed
.
images
)
>
0
else
None
with
closing
(
p
):
processed
=
processing
.
process_images
(
p
)
image
=
processed
.
images
[
0
]
if
len
(
processed
.
images
)
>
0
else
None
if
unload
:
shared
.
sd_model
.
cond_stage_model
.
to
(
devices
.
cpu
)
...
...
modules/img2img.py
浏览文件 @
44c27ebc
import
os
from
contextlib
import
closing
from
pathlib
import
Path
import
numpy
as
np
...
...
@@ -217,18 +218,17 @@ def img2img(id_task: str, mode: int, prompt: str, negative_prompt: str, prompt_s
if
mask
:
p
.
extra_generation_params
[
"Mask blur"
]
=
mask_blur
if
is_batch
:
assert
not
shared
.
cmd_opts
.
hide_ui_dir_config
,
"Launched with --hide-ui-dir-config, batch img2img disabled"
with
closing
(
p
):
if
is_batch
:
assert
not
shared
.
cmd_opts
.
hide_ui_dir_config
,
"Launched with --hide-ui-dir-config, batch img2img disabled"
process_batch
(
p
,
img2img_batch_input_dir
,
img2img_batch_output_dir
,
img2img_batch_inpaint_mask_dir
,
args
,
to_scale
=
selected_scale_tab
==
1
,
scale_by
=
scale_by
,
use_png_info
=
img2img_batch_use_png_info
,
png_info_props
=
img2img_batch_png_info_props
,
png_info_dir
=
img2img_batch_png_info_dir
)
process_batch
(
p
,
img2img_batch_input_dir
,
img2img_batch_output_dir
,
img2img_batch_inpaint_mask_dir
,
args
,
to_scale
=
selected_scale_tab
==
1
,
scale_by
=
scale_by
,
use_png_info
=
img2img_batch_use_png_info
,
png_info_props
=
img2img_batch_png_info_props
,
png_info_dir
=
img2img_batch_png_info_dir
)
processed
=
Processed
(
p
,
[],
p
.
seed
,
""
)
else
:
processed
=
modules
.
scripts
.
scripts_img2img
.
run
(
p
,
*
args
)
if
processed
is
None
:
processed
=
process_images
(
p
)
p
.
close
()
processed
=
Processed
(
p
,
[],
p
.
seed
,
""
)
else
:
processed
=
modules
.
scripts
.
scripts_img2img
.
run
(
p
,
*
args
)
if
processed
is
None
:
processed
=
process_images
(
p
)
shared
.
total_tqdm
.
clear
()
...
...
modules/textual_inversion/textual_inversion.py
浏览文件 @
44c27ebc
import
os
from
collections
import
namedtuple
from
contextlib
import
closing
import
torch
import
tqdm
...
...
@@ -584,8 +585,9 @@ def train_embedding(id_task, embedding_name, learn_rate, batch_size, gradient_st
preview_text
=
p
.
prompt
processed
=
processing
.
process_images
(
p
)
image
=
processed
.
images
[
0
]
if
len
(
processed
.
images
)
>
0
else
None
with
closing
(
p
):
processed
=
processing
.
process_images
(
p
)
image
=
processed
.
images
[
0
]
if
len
(
processed
.
images
)
>
0
else
None
if
unload
:
shared
.
sd_model
.
first_stage_model
.
to
(
devices
.
cpu
)
...
...
modules/txt2img.py
浏览文件 @
44c27ebc
from
contextlib
import
closing
import
modules.scripts
from
modules
import
sd_samplers
,
processing
from
modules.generation_parameters_copypaste
import
create_override_settings_dict
...
...
@@ -53,12 +55,11 @@ def txt2img(id_task: str, prompt: str, negative_prompt: str, prompt_styles, step
if
cmd_opts
.
enable_console_prompts
:
print
(
f
"
\n
txt2img:
{
prompt
}
"
,
file
=
shared
.
progress_print_out
)
processed
=
modules
.
scripts
.
scripts_txt2img
.
run
(
p
,
*
args
)
if
processed
is
None
:
processed
=
processing
.
process_images
(
p
)
with
closing
(
p
):
processed
=
modules
.
scripts
.
scripts_txt2img
.
run
(
p
,
*
args
)
p
.
close
()
if
processed
is
None
:
processed
=
processing
.
process_images
(
p
)
shared
.
total_tqdm
.
clear
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录