custom-diffusion icon indicating copy to clipboard operation
custom-diffusion copied to clipboard

Must I use regulization imgs retrieved from laion?

Open CoderZhangYx opened this issue 1 year ago • 2 comments

Thanks for your wonderful work! When i want to train a model for myself, i found that the code starts to download imgs from laion. Is this process necessary? Could i use local images? In other words, can i prepare the regulization images myself and specify them for the code?

CoderZhangYx avatar May 06 '23 08:05 CoderZhangYx

Hi, you can provide your own regularization images as well. E.g., if using diffusers:

  1. If your regularization images have unique prompt for each image. Save images with path class_data_dir/{'_'.join(class_prompt.split())} and have an images.txt and caption.txt in class_data_dir. The images.txt should have the absolute path to the image and caption.txt its corresponding text caption. Also modify the num_class_images argument to the number of images you have.

  2. If all the regularization images have a single common prompt. Disable real_prior flag during training. And have num_class_images in the class_data_dir. And provide the common prompt as class_prompt argument.

Let me know if this doesn't suit your requirement. And I can try to make the code more modular to support this by default. Thanks.

nupurkmr9 avatar May 07 '23 17:05 nupurkmr9

Hi! Thanks for your reply! Useful solutions! But while following your "single common prompt" suggestion, there comes 2 cases:

  1. concept_list should be None, otherwise class_data_dir won't work. And this is useful for single-concept training only.

  2. for multi-concept training, it seems that further modification for the args should be taken. I'm done by modifying assets/concept_list.json, as well as disabling real_prior. In this way, class_prompt and class_data_dir are specified in assets/concept_list.json and thus not needed in args.

Hope that you can provide detailed instruction in documents for later followers! Thanks for your nice work!

CoderZhangYx avatar May 11 '23 07:05 CoderZhangYx