Is it possible to train SD modes with Dreambooth in Sagemaker HuggingFace estimators?

Hi Santiago - yes that is possible :slight_smile: You can convert Hugging Face’s dreambooth training script into a training script that runs on SageMaker. Then you can just create a regular HF estimator and run it (you need to make sure to include all the required packages in a requirements.txt file).

My requirements.txt file is

transformers==4.25.1
diffusers[torch]
bitsandbytes

A few things to watch out for when converting the original script into a script that runs on SageMaker:

  • You will have to store your images on S3 and implement a mechanism within the training script to retrieve the images from S3 (instead from a local folder
  • SageMaker doesn’t support argparse actions , so will you have to rewrite that part of the training script
  • If you use prior class preservation and textencoder finetuning then you will have to use a g5 instance (with 24 GB VRAM)
  • If you want to keep & reuse the generated class images, you will have to implement some S3 logic to store those and read them

Cheers
Heiko

1 Like