Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
3ce2bfdf
Commit
3ce2bfdf
authored
Oct 29, 2022
by
Muhammad Rizqi Nur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add cleanup after training
parent
ab27c111
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
200 additions
and
186 deletions
+200
-186
modules/hypernetworks/hypernetwork.py
modules/hypernetworks/hypernetwork.py
+105
-96
modules/textual_inversion/textual_inversion.py
modules/textual_inversion/textual_inversion.py
+95
-90
No files found.
modules/hypernetworks/hypernetwork.py
View file @
3ce2bfdf
...
...
@@ -398,6 +398,8 @@ def train_hypernetwork(hypernetwork_name, learn_rate, batch_size, data_root, log
forced_filename
=
"<none>"
pbar
=
tqdm
.
tqdm
(
enumerate
(
ds
),
total
=
steps
-
ititial_step
)
try
:
for
i
,
entries
in
pbar
:
hypernetwork
.
step
=
i
+
ititial_step
if
len
(
loss_dict
)
>
0
:
...
...
@@ -510,6 +512,13 @@ Last saved hypernetwork: {html.escape(last_saved_file)}<br/>
Last saved image: {html.escape(last_saved_image)}<br/>
</p>
"""
finally
:
if
weights
:
for
weight
in
weights
:
weight
.
requires_grad
=
False
if
unload
:
shared
.
sd_model
.
cond_stage_model
.
to
(
devices
.
device
)
shared
.
sd_model
.
first_stage_model
.
to
(
devices
.
device
)
report_statistics
(
loss_dict
)
checkpoint
=
sd_models
.
select_checkpoint
()
...
...
modules/textual_inversion/textual_inversion.py
View file @
3ce2bfdf
...
...
@@ -283,6 +283,8 @@ def train_embedding(embedding_name, learn_rate, batch_size, data_root, log_direc
embedding_yet_to_be_embedded
=
False
pbar
=
tqdm
.
tqdm
(
enumerate
(
ds
),
total
=
steps
-
ititial_step
)
try
:
for
i
,
entries
in
pbar
:
embedding
.
step
=
i
+
ititial_step
...
...
@@ -396,6 +398,9 @@ Last saved embedding: {html.escape(last_saved_file)}<br/>
Last saved image: {html.escape(last_saved_image)}<br/>
</p>
"""
finally
:
if
embedding
and
embedding
.
vec
is
not
None
:
embedding
.
vec
.
requires_grad
=
False
checkpoint
=
sd_models
.
select_checkpoint
()
...
...
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