InvokeAI icon indicating copy to clipboard operation
InvokeAI copied to clipboard

[bug]: Textual Inversion tries to process invisible . files, crashes

Open gsreeves opened this issue 2 years ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

OS

macOS

GPU

mps

VRAM

64GB Shared

What happened?

Textual Inversion Training script feeds ALL files in source directory, including the .DS_Store file that appears in any folder accessed by Finder on Mac. I tested this bug by removing the offending file and the script ran without throwing the error. This suggests that the fix is to filter the list to only image files before any PIL processing.

  File "~/invokeai/.venv/lib/python3.10/site-packages/ldm/invoke/training/textual_inversion_training.py", line 471, in __getitem__
    image = Image.open(self.image_paths[i % self.num_images])
  File "~/invokeai/.venv/lib/python3.10/site-packages/PIL/Image.py", line 3283, in open
    raise UnidentifiedImageError(msg)
PIL.UnidentifiedImageError: cannot identify image file '~/invokeai/text-inversion-training-data/cement-style-768/.DS_Store'

Screenshots

No response

Additional context

Only happens when there is a non-image file in textual-inversion-training source folder

Contact Details

No response

gsreeves avatar Feb 18 '23 19:02 gsreeves