JoePenna / Dreambooth-Stable-Diffusion

Implementation of Dreambooth (https://arxiv.org/abs/2208.12242) by way of Textual Inversion (https://arxiv.org/abs/2208.01618) for Stable Diffusion (https://arxiv.org/abs/2112.10752). Tweaks focused on training faces, objects, and styles.
MIT License
3.2k stars 554 forks source link

UnidentifiedImageError: crashing download of images #24

Closed Airburner closed 2 years ago

Airburner commented 2 years ago

Hey I have error:

UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7f0981e1e950>

When I try to load images to train the model

Airburner commented 2 years ago

UnidentifiedImageError Traceback (most recent call last) Cell In [35], line 26 23 return None 24 return Image.open(BytesIO(response.content)).convert("RGB") ---> 26 images = list(filter(None,[download_image(url) for url in urls])) 27 save_path = "./training_samples" 28 if not os.path.exists(save_path):

Cell In [35], line 26, in (.0) 23 return None 24 return Image.open(BytesIO(response.content)).convert("RGB") ---> 26 images = list(filter(None,[download_image(url) for url in urls])) 27 save_path = "./training_samples" 28 if not os.path.exists(save_path):

Cell In [35], line 24, in download_image(url) 22 except: 23 return None ---> 24 return Image.open(BytesIO(response.content)).convert("RGB")

File /venv/lib/python3.8/site-packages/PIL/Image.py:3008, in open(fp, mode, formats) 3006 for message in accept_warnings: 3007 warnings.warn(message) -> 3008 raise UnidentifiedImageError( 3009 "cannot identify image file %r" % (filename if filename else fp) 3010 )

UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7f0981e1e950>

jchirik commented 2 years ago

Try restarting the kernel? I was stuck for a while but worked after restarting

Airburner commented 2 years ago

Thanks, I think that changing file location from Gdrive to Dropbox helped.

a-straus commented 2 years ago

Thanks, I think that changing file location from Gdrive to Dropbox helped.

Hey, wondering what you meant by this? That you were hosting your files on Dropbox but changed the URLs to Gdrive and that got you past this error? I'm having the same error hosting my photos on imgur.

EDIT: I got past this step because I was uploading my imgur files without a .png extension. I put .png on the end of the imgur url and it worked

Airburner commented 2 years ago

Yes, it was problem with img hosting server and link, now I am using dropbox and it's ok!