Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stable-diffusion-webui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
stable-diffusion-webui
Commits
82adae37
Unverified
Commit
82adae37
authored
Aug 24, 2022
by
AUTOMATIC1111
Committed by
GitHub
Aug 24, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6 from hlky/master
@hlky torch_gc/empty cache after generation
parents
34e97955
15a700bb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
webui.py
webui.py
+6
-2
No files found.
webui.py
View file @
82adae37
...
...
@@ -128,6 +128,9 @@ def create_random_tensors(shape, seeds):
x
=
torch
.
stack
(
xs
)
return
x
def
torch_gc
():
torch
.
cuda
.
empty_cache
()
torch
.
cuda
.
ipc_collect
()
def
load_GFPGAN
():
model_name
=
'GFPGANv1.3'
...
...
@@ -304,7 +307,7 @@ def process_images(outpath, func_init, func_sample, prompt, seed, sampler_name,
"""this is the main loop that both txt2img and img2img use; it calls func_init once inside all the scopes and func_sample once per batch"""
assert
prompt
is
not
None
torch
.
cuda
.
empty_cache
()
torch
_gc
()
if
seed
==
-
1
:
seed
=
random
.
randrange
(
4294967294
)
...
...
@@ -405,6 +408,7 @@ def process_images(outpath, func_init, func_sample, prompt, seed, sampler_name,
output_images
.
insert
(
0
,
grid
)
grid
.
save
(
os
.
path
.
join
(
outpath
,
f
'grid-{grid_count:04}.{opt.grid_format}'
))
grid_count
+=
1
...
...
@@ -415,7 +419,7 @@ Steps: {steps}, Sampler: {sampler_name}, CFG scale: {cfg_scale}, Seed: {seed}{',
for
comment
in
comments
:
info
+=
"
\n\n
"
+
comment
torch_gc
()
return
output_images
,
seed
,
info
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment