# Using Available Class images for Dreambooth Stable diffusion

**URL:** <https://discuss.huggingface.co/t/using-available-class-images-for-dreambooth-stable-diffusion/39183>\
**Category:** 🧨 Diffusers\
**Created:** [May 9, 2023, 5:53am UTC](https://discuss.huggingface.co/t/using-available-class-images-for-dreambooth-stable-diffusion/39183 "2023-05-09T05:53:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Avishka-Perera](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@Avishka-Perera](https://discuss.huggingface.co/u/Avishka-Perera)\
**Post date:** [May 9, 2023, 5:53am UTC](https://discuss.huggingface.co/t/using-available-class-images-for-dreambooth-stable-diffusion/39183/1 "2023-05-09T05:53:08Z")

</div>

Hello,

I am new to dreambooth.

I have a large set of images consisting of various paddy leaf species. I have 248 different classes (species) and around 100 images per class. From these class images, _STEP 1_: I want to generate more images for each class. And as the next step, _STEP 2_: I want to make hybrids among the classes. For instance, "give me a paddy leaf sample where the leaf texture is like class X; the leaf shape is like class Y; and leaf size is like class Z.

My plan is to use Dreambooth and Stable Diffusion for this task.

**STEP 1**

I’ve setup the data directories with class images and instance images. The class images directory contains 1 image from each class making up to 248 images. The instance directory contains 3 images from class X.

The script I am using for this is [diffusers/train\_dreambooth.py at main · huggingface/diffusers · GitHub](https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth.py). I’ve modified the script to use it as a module by replacing the argparser. Rest is the same. This is my code.

```auto
train_dreambooth(
    pretrained_model_name_or_path=MODEL_NAME,
    instance_data_dir=INSTANCE_DIR,
    class_data_dir=CLASS_DIR,
    output_dir=OUTPUT_DIR,
    with_prior_preservation=True,
    prior_loss_weight=1.0,
    instance_prompt="a photo of X paddy leaves",
    class_prompt="a photo of paddy leaves",
    resolution=512,
    train_batch_size=1,
    gradient_accumulation_steps=1,
    gradient_checkpointing=True,
    use_8bit_adam=True,
    enable_xformers_memory_efficient_attention=True,
    set_grads_to_none=True,
    learning_rate=2e-6,
    lr_scheduler="constant",
    lr_warmup_steps=0,
    # num_class_images=200,
    max_train_steps=800
)

```

When I set the class directory and instance directory and train, it shows that class images are being generated.

```auto
Generating class images: 88%|████████▊ | 22/25 [09:36<01:19, 26.43s/it]

```

What am I doing wrong?

**STEP 2**  
I am planning to change the same model for each instance to add the grade to the model. Then to generate hybrids. Is it correct

Any help is very much appreciated,  
Thanks 😃

---

<div class="post-metadata">

**Author:** ![williamberman](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/williamberman/32/14112_2.png) [@williamberman](https://discuss.huggingface.co/u/williamberman)\
**Post date:** [May 22, 2023, 6:23pm UTC](https://discuss.huggingface.co/t/using-available-class-images-for-dreambooth-stable-diffusion/39183/2 "2023-05-22T18:23:04Z")

</div>

hey @Avishka-Perera sorry I’m not sure I understand your question
