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
184e6701
Commit
184e6701
authored
Jan 04, 2023
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix the merge
parent
8839b372
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
+5
-9
modules/textual_inversion/textual_inversion.py
modules/textual_inversion/textual_inversion.py
+5
-9
No files found.
modules/textual_inversion/textual_inversion.py
View file @
184e6701
...
@@ -251,6 +251,7 @@ def validate_train_inputs(model_name, learn_rate, batch_size, gradient_step, dat
...
@@ -251,6 +251,7 @@ def validate_train_inputs(model_name, learn_rate, batch_size, gradient_step, dat
if
save_model_every
or
create_image_every
:
if
save_model_every
or
create_image_every
:
assert
log_directory
,
"Log directory is empty"
assert
log_directory
,
"Log directory is empty"
def
create_dummy_mask
(
x
,
width
=
None
,
height
=
None
):
def
create_dummy_mask
(
x
,
width
=
None
,
height
=
None
):
if
shared
.
sd_model
.
model
.
conditioning_key
in
{
'hybrid'
,
'concat'
}:
if
shared
.
sd_model
.
model
.
conditioning_key
in
{
'hybrid'
,
'concat'
}:
...
@@ -380,17 +381,12 @@ def train_embedding(embedding_name, learn_rate, batch_size, gradient_step, data_
...
@@ -380,17 +381,12 @@ def train_embedding(embedding_name, learn_rate, batch_size, gradient_step, data_
break
break
with
devices
.
autocast
():
with
devices
.
autocast
():
# c = stack_conds(batch.cond).to(devices.device)
# mask = torch.tensor(batch.emb_index).to(devices.device, non_blocking=pin_memory)
# print(mask)
# c[:, 1:1+embedding.vec.shape[0]] = embedding.vec.to(devices.device, non_blocking=pin_memory)
if
img_c
is
None
:
img_c
=
create_dummy_mask
(
c
,
training_width
,
training_height
)
x
=
batch
.
latent_sample
.
to
(
devices
.
device
,
non_blocking
=
pin_memory
)
x
=
batch
.
latent_sample
.
to
(
devices
.
device
,
non_blocking
=
pin_memory
)
c
=
shared
.
sd_model
.
cond_stage_model
(
batch
.
cond_text
)
c
=
shared
.
sd_model
.
cond_stage_model
(
batch
.
cond_text
)
if
img_c
is
None
:
img_c
=
create_dummy_mask
(
c
,
training_width
,
training_height
)
cond
=
{
"c_concat"
:
[
img_c
],
"c_crossattn"
:
[
c
]}
cond
=
{
"c_concat"
:
[
img_c
],
"c_crossattn"
:
[
c
]}
loss
=
shared
.
sd_model
(
x
,
cond
)[
0
]
/
gradient_step
loss
=
shared
.
sd_model
(
x
,
cond
)[
0
]
/
gradient_step
del
x
del
x
...
...
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