Skip to content

Commit

Permalink
Merge pull request #863 from bghira/bugfix/validation-img-filenames
Browse files Browse the repository at this point in the history
fix validation image filename only using resolution from first img, and, unreadable/untypeable parenthesis
  • Loading branch information
bghira authored Aug 24, 2024
2 parents 5e7a014 + 64a2e62 commit 66f9902
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion helpers/training/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1240,12 +1240,20 @@ def validate_prompt(
def _save_images(self, validation_images, validation_shortname, validation_prompt):
validation_img_idx = 0
for validation_image in validation_images[validation_shortname]:
res = self.validation_resolutions[validation_img_idx]
if "x" in res:
res_label = str(res)
elif type(res) is tuple:
res_label = f"{res[0]}x{res[1]}"
else:
res_label = f"{res}x{res}"
validation_image.save(
os.path.join(
self.save_dir,
f"step_{StateTracker.get_global_step()}_{validation_shortname}_{str(self.validation_resolutions[validation_img_idx])}.png",
f"step_{StateTracker.get_global_step()}_{validation_shortname}_{res_label}.png",
)
)
validation_img_idx += 1

def _log_validations_to_webhook(
self, validation_images, validation_shortname, validation_prompt
Expand Down

0 comments on commit 66f9902

Please sign in to comment.