diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

Textual Inversion training notebook only takes in remote images

Open minimaxir opened this issue 3 years ago • 7 comments

The Textual Inversion training notebook in Google Colab only takes in remote images, instead of also being able to take in local images either uploaded from the desktop or linked from Google Drive, both of which are more common workflows.

urls = [
      "https://huggingface.co/datasets/valhalla/images/resolve/main/2.jpeg",
      "https://huggingface.co/datasets/valhalla/images/resolve/main/3.jpeg",
      "https://huggingface.co/datasets/valhalla/images/resolve/main/5.jpeg",
      "https://huggingface.co/datasets/valhalla/images/resolve/main/6.jpeg",
      ## You can add additional images here
      ]

import requests
import glob
from io import BytesIO

def download_image(url):
  try:
    response = requests.get(url)
  except:
    return None
  return Image.open(BytesIO(response.content)).convert("RGB")

images = list(filter(None,[download_image(url) for url in urls]))

The inputs to the image cell should be able to take in both remote or local images depending on if an external URL is detected.

Twitter discussion

minimaxir avatar Sep 08 '22 00:09 minimaxir

+1 - think this feature would make a lot of sense. cc @patil-suraj :-)

patrickvonplaten avatar Sep 08 '22 21:09 patrickvonplaten

Makes sense! Will update the notebooks

patil-suraj avatar Sep 09 '22 06:09 patil-suraj

Gently ping here to update the notebook cc @patil-suraj

patrickvonplaten avatar Sep 13 '22 16:09 patrickvonplaten

Makes sense! Will update the notebooks

Can You guys open up vector numbers so we can change them ? I got much better results with 2 and still great editability https://github.com/rinongal/textual_inversion/issues/35

Also i agree on file selector cause now giving it our own images is a PITA

1blackbar avatar Sep 13 '22 17:09 1blackbar

Ping @patil-suraj here again :-)

patrickvonplaten avatar Oct 25 '22 09:10 patrickvonplaten

@patil-suraj

patrickvonplaten avatar Nov 20 '22 19:11 patrickvonplaten

Ping again @patil-suraj @williamberman @pcuenca

patrickvonplaten avatar Dec 19 '22 16:12 patrickvonplaten

cc @patil-suraj

patrickvonplaten avatar Jan 16 '23 11:01 patrickvonplaten

Just updated the colab to allow load images from the local directory or from drive path. https://github.com/huggingface/notebooks/blob/main/diffusers/sd_textual_inversion_training.ipynb

Closing this issue now.

patil-suraj avatar Jan 16 '23 13:01 patil-suraj