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
97749b7c
Unverified
Commit
97749b7c
authored
Oct 22, 2022
by
discus0434
Committed by
GitHub
Oct 22, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'AUTOMATIC1111:master' into master
parents
7912acef
7fd90128
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
hypernetwork.py
modules/hypernetworks/hypernetwork.py
+11
-0
ui.py
modules/ui.py
+3
-0
No files found.
modules/hypernetworks/hypernetwork.py
View file @
97749b7c
...
...
@@ -325,6 +325,8 @@ def train_hypernetwork(hypernetwork_name, learn_rate, batch_size, data_root, log
# if optimizer == "AdamW": or else Adam / AdamW / SGD, etc...
optimizer
=
torch
.
optim
.
AdamW
(
weights
,
lr
=
scheduler
.
learn_rate
)
steps_without_grad
=
0
pbar
=
tqdm
.
tqdm
(
enumerate
(
ds
),
total
=
steps
-
ititial_step
)
for
i
,
entries
in
pbar
:
hypernetwork
.
step
=
i
+
ititial_step
...
...
@@ -347,8 +349,17 @@ def train_hypernetwork(hypernetwork_name, learn_rate, batch_size, data_root, log
losses
[
hypernetwork
.
step
%
losses
.
shape
[
0
]]
=
loss
.
item
()
optimizer
.
zero_grad
()
weights
[
0
]
.
grad
=
None
loss
.
backward
()
if
weights
[
0
]
.
grad
is
None
:
steps_without_grad
+=
1
else
:
steps_without_grad
=
0
assert
steps_without_grad
<
10
,
'no gradient found for the trained weight after backward() for 10 steps in a row; this is a bug; training cannot continue'
optimizer
.
step
()
mean_loss
=
losses
.
mean
()
if
torch
.
isnan
(
mean_loss
):
raise
RuntimeError
(
"Loss diverged."
)
...
...
modules/ui.py
View file @
97749b7c
...
...
@@ -1648,6 +1648,9 @@ Requested path was: {f}
css
=
""
for
cssfile
in
modules
.
scripts
.
list_files_with_name
(
"style.css"
):
if
not
os
.
path
.
isfile
(
cssfile
):
continue
with
open
(
cssfile
,
"r"
,
encoding
=
"utf8"
)
as
file
:
css
+=
file
.
read
()
+
"
\n
"
...
...
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