notebooks icon indicating copy to clipboard operation
notebooks copied to clipboard

sd-xl dreambooth QOL improvements

Open linoytsaban opened this issue 1 year ago • 12 comments

A few QOL improvements:

  • removed assert from image_grid
  • improved login experience
  • add link to model at the end of training
  • added local image upload option

linoytsaban avatar Aug 10 '23 16:08 linoytsaban

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

cc @sayakpaul

apolinario avatar Aug 10 '23 17:08 apolinario

View / edit / reply to this conversation on ReviewNB

sayakpaul commented on 2023-08-11T04:24:02Z ----------------------------------------------------------------

import os
from google.colab import files

# pick a name for the image folder
local_dir = "./dog" #@param
os.makedirs(local_dir)
os.chdir(local_dir)

# choose and upload local images into the newly created directory
uploaded_images = files.upload()
os.chdir("/content") # back to parent directory

Better separation of the comments and grouping of semantically similar code blocks.


View / edit / reply to this conversation on ReviewNB

sayakpaul commented on 2023-08-11T04:24:03Z ----------------------------------------------------------------

Is it option 2? If so, let's make it explicitly written.


View / edit / reply to this conversation on ReviewNB

sayakpaul commented on 2023-08-11T04:24:03Z ----------------------------------------------------------------

Since we're allowing the option to user to upload their own images too, let's add a comment here to tell them that they adjust the glob path accordingly.


linoytsaban commented on 2023-08-11T08:43:24Z ----------------------------------------------------------------

Something like that?

#%%

import glob

path to all images in the local dir, of type imgs_file_type

imgs_file_type = ".jpeg" imgs_paths = local_dir+"/*"+imgs_file_type

imgs = [Image.open(path) for path in glob.glob(imgs_paths)] image_grid(imgs, 1, 5)

sayakpaul commented on 2023-08-11T09:07:24Z ----------------------------------------------------------------

Even just a comment would suffice.

View / edit / reply to this conversation on ReviewNB

sayakpaul commented on 2023-08-11T04:24:04Z ----------------------------------------------------------------

from huggingface_hub import whoami
from pathlib import Path

username = whoami(token=Path("/root/.cache/huggingface/"))["name"]

link_to_model = "https://huggingface.co/{}/lora-trained-xl-colab".format(username)

print("Check out your model here:", link_to_model)

apolinario commented on 2023-08-11T07:58:12Z ----------------------------------------------------------------

Instead of print we could use

from IPython.display import display, Markdown

display(Markdown(f"### Your model has finished training.\nAccess it here"))

To draw more attention

View / edit / reply to this conversation on ReviewNB

sayakpaul commented on 2023-08-11T04:24:05Z ----------------------------------------------------------------

This should go to a markdown cell.


View / edit / reply to this conversation on ReviewNB

sayakpaul commented on 2023-08-11T04:24:06Z ----------------------------------------------------------------

Line #12.    #change repo_id to yours to generate images with your model

Space between # and the rest of the comment.


View / edit / reply to this conversation on ReviewNB

sayakpaul commented on 2023-08-11T04:24:07Z ----------------------------------------------------------------

Line #1.    prompt = "a photo of sks dog in a bucket"

We can also make this a @param. 


Instead of print we could use

from IPython.display import display, Markdown

display(Markdown(f"### Your model has finished training.\nAccess it here"))

To draw more attention


View entire conversation on ReviewNB

apolinario avatar Aug 11 '23 07:08 apolinario

Something like that?

import glob

path to all images in the local dir, of type imgs_file_type

imgs_file_type = ".jpeg" imgs_paths = local_dir+"/*"+imgs_file_type

imgs = [Image.open(path) for path in glob.glob(imgs_paths)] image_grid(imgs, 1, 5)


View entire conversation on ReviewNB

linoytsaban avatar Aug 11 '23 08:08 linoytsaban

Even just a comment would suffice.


View entire conversation on ReviewNB

sayakpaul avatar Aug 11 '23 09:08 sayakpaul