Skip to content

Commit

Permalink
Merge pull request #454 from kvzn/master
Browse files Browse the repository at this point in the history
Fixed the bug that it did not support capital image extensions like .JPG, .JPEG
  • Loading branch information
bmaltais authored Mar 26, 2023
2 parents b6332ce + 3f86e8f commit ad018dd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
9 changes: 4 additions & 5 deletions dreambooth_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,10 @@ def train_model(
num_images = len(
[
f
for f in os.listdir(os.path.join(train_data_dir, folder))
if f.endswith('.jpg')
or f.endswith('.jpeg')
or f.endswith('.png')
or f.endswith('.webp')
for f, lower_f in (
(file, file.lower()) for file in os.listdir(os.path.join(train_data_dir, folder))
)
if lower_f.endswith(('.jpg', '.jpeg', '.png', '.webp'))
]
)

Expand Down
6 changes: 4 additions & 2 deletions finetune_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,10 @@ def train_model(
image_num = len(
[
f
for f in os.listdir(image_folder)
if f.endswith('.jpg') or f.endswith('.png') or f.endswith('.webp')
for f, lower_f in (
(file, file.lower()) for file in os.listdir(image_folder)
)
if lower_f.endswith(('.jpg', '.jpeg', '.png', '.webp'))
]
)
print(f'image_num = {image_num}')
Expand Down
10 changes: 5 additions & 5 deletions lora_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,14 +419,14 @@ def train_model(
num_images = len(
[
f
for f in os.listdir(os.path.join(train_data_dir, folder))
if f.endswith('.jpg')
or f.endswith('.jpeg')
or f.endswith('.png')
or f.endswith('.webp')
for f, lower_f in (
(file, file.lower()) for file in os.listdir(os.path.join(train_data_dir, folder))
)
if lower_f.endswith(('.jpg', '.jpeg', '.png', '.webp'))
]
)


print(f'Folder {folder}: {num_images} images found')

# Calculate the total number of steps for this folder
Expand Down
9 changes: 4 additions & 5 deletions textual_inversion_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,10 @@ def train_model(
num_images = len(
[
f
for f in os.listdir(os.path.join(train_data_dir, folder))
if f.endswith('.jpg')
or f.endswith('.jpeg')
or f.endswith('.png')
or f.endswith('.webp')
for f, lower_f in (
(file, file.lower()) for file in os.listdir(os.path.join(train_data_dir, folder))
)
if lower_f.endswith(('.jpg', '.jpeg', '.png', '.webp'))
]
)

Expand Down

0 comments on commit ad018dd

Please sign in to comment.