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
72497895
Commit
72497895
authored
Jan 07, 2023
by
dan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move batchsize check
parent
669fb18d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
hypernetwork.py
modules/hypernetworks/hypernetwork.py
+1
-1
dataset.py
modules/textual_inversion/dataset.py
+2
-2
No files found.
modules/hypernetworks/hypernetwork.py
View file @
72497895
...
...
@@ -456,7 +456,7 @@ def train_hypernetwork(hypernetwork_name, learn_rate, batch_size, gradient_step,
pin_memory
=
shared
.
opts
.
pin_memory
ds
=
modules
.
textual_inversion
.
dataset
.
PersonalizedBase
(
data_root
=
data_root
,
width
=
training_width
,
height
=
training_height
,
repeats
=
shared
.
opts
.
training_image_repeats_per_epoch
,
placeholder_token
=
hypernetwork_name
,
model
=
shared
.
sd_model
,
cond_model
=
shared
.
sd_model
.
cond_stage_model
,
device
=
devices
.
device
,
template_file
=
template_file
,
include_cond
=
True
,
batch_size
=
batch_size
,
gradient_step
=
gradient_step
,
shuffle_tags
=
shuffle_tags
,
tag_drop_out
=
tag_drop_out
,
latent_sampling_method
=
latent_sampling_method
)
ds
=
modules
.
textual_inversion
.
dataset
.
PersonalizedBase
(
data_root
=
data_root
,
width
=
training_width
,
height
=
training_height
,
repeats
=
shared
.
opts
.
training_image_repeats_per_epoch
,
placeholder_token
=
hypernetwork_name
,
model
=
shared
.
sd_model
,
cond_model
=
shared
.
sd_model
.
cond_stage_model
,
device
=
devices
.
device
,
template_file
=
template_file
,
include_cond
=
True
,
batch_size
=
batch_size
,
gradient_step
=
gradient_step
,
shuffle_tags
=
shuffle_tags
,
tag_drop_out
=
tag_drop_out
,
latent_sampling_method
=
latent_sampling_method
,
varsize
=
varsize
)
if
shared
.
opts
.
save_training_settings_to_txt
:
saved_params
=
dict
(
...
...
modules/textual_inversion/dataset.py
View file @
72497895
...
...
@@ -46,6 +46,8 @@ class PersonalizedBase(Dataset):
assert
data_root
,
'dataset directory not specified'
assert
os
.
path
.
isdir
(
data_root
),
"Dataset directory doesn't exist"
assert
os
.
listdir
(
data_root
),
"Dataset directory is empty"
if
varsize
:
assert
batch_size
==
1
,
'variable img size must have batch size 1'
self
.
image_paths
=
[
os
.
path
.
join
(
data_root
,
file_path
)
for
file_path
in
os
.
listdir
(
data_root
)]
...
...
@@ -61,8 +63,6 @@ class PersonalizedBase(Dataset):
image
=
Image
.
open
(
path
)
.
convert
(
'RGB'
)
if
not
varsize
:
image
=
image
.
resize
((
width
,
height
),
PIL
.
Image
.
BICUBIC
)
else
:
assert
batch_size
==
1
,
'variable img size must have batch size 1'
except
Exception
:
continue
...
...
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