Step-by-Step Guide to Fine-Tuning SDXL for the Advertising, Media and Entertainment Sector

Step-by-Step Guide to Fine-Tuning SDXL for the Advertising, Media and Entertainment Sector

The advertising, media, and entertainment sector is an ever-evolving landscape characterized by a growing demand for creativity, personalization, and immediate engagement. Fine-tuning SDXL (Stable Diffusion XL) for this sector is pivotal to ensure that the generated content is not only relevant and resonant with diverse audiences but also adheres to the unique compliance and brand voice standards prevalent in these industries.?

Precise calibration of SDXL can enhance content discovery, optimize ad targeting, and automate routine creative processes, thereby unlocking new levels of efficiency and innovation.

This fine-tuning process is essential to capture the nuances that drive consumer behavior, ensuring that every piece of content—be it an advertisement, a movie script, or a viral marketing campaign—resonates deeply with and contributes to a compelling user experience.

Using DreamBooth to Fine-Tune SDXL

DreamBooth is a technology developed by Google researchers that allows for the personalization of AI models, particularly for the generation of images from text descriptions. It is a method of fine-tuning AI models, like Stable Diffusion, using just a few images of a specific subject. This process involves creating a ‘personalized’ text-to-image model that can generate novel renditions of the subject in various contexts and styles.

The way DreamBooth works is by taking a small number of images of a subject and using them to fine-tune a pre-trained text-to-image model. This involves introducing a unique identifier associated with the subject within the text prompts used during the fine-tuning process. The model then learns to associate this identifier with the appearance of the subject from the provided images, allowing it to generate new images of the subject when prompted with text containing the identifier.

Launching a GPU Node on E2E Networks

E2E Networks' GPU nodes provide robust and scalable computing resources tailored for high-performance workloads, particularly in the realms of machine learning, deep learning, and data processing. These nodes are equipped with powerful NVIDIA GPUs like A100s, V100s and H100s, renowned for their ability to accelerate computational tasks by parallelizing processes, thereby significantly reducing the time required for data-intensive operations.

Head over to the myaccounts section of the platform to sign up for a GPU node.

Key Features of This Blog

In this blog post, we will guide you through a detailed, step-by-step process to fine-tune SDXL with the innovative DreamBooth technique. Our objective is to create two specialized LoRA adapters: the first one dedicated to an e-commerce product, which will be instrumental in generating bespoke advertising images, and the second one focused on a male model, intended for crafting versatile images suitable for media and entertainment photoshoots.

By the end of this tutorial, you will be equipped with the know-how to leverage the capabilities of SDXL, fine-tuned with DreamBooth, to produce high-quality, tailored imagery for these specific use cases. Whether you're looking to enhance your advertising visuals or enrich your portfolio of entertainment photography, this step-by-step guide will provide you with the tools and insights needed to achieve your creative goals. Let's get started on this journey to unlock the full potential of AI-enhanced image creation.

Make sure you have the AutoTrain module installed on your system to be able to use DreamBooth.


%pip install -U autotrain-advanced
        

Use Case 1: Loading and Generating General Purpose Images Using SDXL



from diffusers import DiffusionPipeline, AutoencoderKL
import torch

vae = AutoencoderKL.from_pretrained(
    "madebyollin/sdxl-vae-fp16-fix",
    torch_dtype=torch.float16
)
pipe = DiffusionPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0",
    vae=vae,
    torch_dtype=torch.float16,
    variant="fp16",
    use_safetensors=True,
)
pipe.to("cuda")

 After loading the base model and the encoder, we create a pipeline for inferencing.
prompt = "A roman gladiator fighting in an arena."

image = pipe(prompt=prompt, num_inference_steps=25, num_images_per_prompt = 4)

        

Create a helper function to display the images in your Jupyter notebook environment:


from PIL import Image

def image_grid(imgs, rows, cols, resize=256):
    assert len(imgs) == rows * cols

    if resize is not None:
        imgs = [img.resize((resize, resize)) for img in imgs]

    w, h = imgs[0].size
    grid_w, grid_h = cols * w, rows * h
    grid = Image.new("RGB", size=(grid_w, grid_h))

    for i, img in enumerate(imgs):
        x = i % cols * w
        y = i // cols * h
        grid.paste(img, box=(x, y))

    return grid


image_grid(image.images, 2, 2)


        

Use Case 2: Fine-Tuning on Handbag Images


We are going to create a fine-tuned LoRA adapter for the 4 images of the handbag shown below:

You can load the above images in your Jupyter notebook using this command:


import glob
imgs = [Image.open(path) for path in glob.glob("handbag/*.jpg")]
        

Training a LoRA adapter for our handbag images:



!autotrain dreambooth \
--model 'stabilityai/stable-diffusion-xl-base-1.0' \
--project-name 'Dreambooth-SDXL-handbag' \
--image-path '/home/vardhanam/sdxl_fine_tune/handbag' \
--prompt "A photo of brown_handbag_1234" \
--resolution 1024 \
--batch-size 1 \
--num-steps 500 \
--gradient-accumulation 4 \
--lr 1e-4 \
--fp16 \
--push-to-hub \
--token 'YOUR_HF_TOKEN' \
--repo-id 'vardhanam/handbag_sdxl_lora'

        

Note that we are calling our handbag brown_handbag_1234 as it is a unique keyword that will be used by the fine-tuned model to identify and generate images of our bag.


> INFO    Namespace(version=False, revision=None, tokenizer=None, image_path='/home/vardhanam/sdxl_fine_tune/handbag', class_image_path=None, prompt='A photo of brown_handbag_1234', class_prompt=None, num_class_images=100, class_labels_conditioning=None, prior_preservation=None, prior_loss_weight=1.0, resolution=1024, center_crop=None, train_text_encoder=None, sample_batch_size=4, num_steps=500, checkpointing_steps=100000, resume_from_checkpoint=None, scale_lr=None, scheduler='constant', warmup_steps=0, num_cycles=1, lr_power=1.0, dataloader_num_workers=0, use_8bit_adam=None, adam_beta1=0.9, adam_beta2=0.999, adam_weight_decay=0.01, adam_epsilon=1e-08, max_grad_norm=1.0, allow_tf32=None, prior_generation_precision=None, local_rank=-1, xformers=None, pre_compute_text_embeddings=None, tokenizer_max_length=None, text_encoder_use_attention_mask=None, rank=4, xl=None, fp16=True, bf16=None, validation_prompt=None, num_validation_images=4, validation_epochs=50, checkpoints_total_limit=None, validation_images=None, logging=None, train=None, deploy=None, inference=None, username=None, backend='local-cli', token='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', repo_id='vardhanam/handbag_sdxl_lora', push_to_hub=True, model='stabilityai/stable-diffusion-xl-base-1.0', project_name='Dreambooth-SDXL-handbag', seed=42, epochs=1, gradient_accumulation=4, disable_gradient_checkpointing=None, lr=0.0001, log='none', data_path=None, train_split='train', valid_split=None, batch_size=1, func=)
> INFO    Running DreamBooth Training
> WARNING Parameters supplied but not used: train_split, deploy, version, valid_split, data_path, train, inference, backend, func, log
> INFO    Dataset: Dreambooth-SDXL-handbag (dreambooth)

> INFO    Saving concept images
> INFO    /home/vardhanam/sdxl_fine_tune/handbag/2.jpg
> INFO    Saving concept images
> INFO    /home/vardhanam/sdxl_fine_tune/handbag/3.jpg
> INFO    Saving concept images
> INFO    /home/vardhanam/sdxl_fine_tune/handbag/1.jpg
> INFO    Saving concept images
> INFO    /home/vardhanam/sdxl_fine_tune/handbag/4.jpg
> INFO    Starting local training...
> INFO    {"model":"stabilityai/stable-diffusion-xl-base-1.0","revision":null,"tokenizer":null,"image_path":"Dreambooth-SDXL-handbag/autotrain-data","class_image_path":null,"prompt":"A photo of brown_handbag_1234","class_prompt":null,"num_class_images":100,"class_labels_conditioning":null,"prior_preservation":false,"prior_loss_weight":1.0,"project_name":"Dreambooth-SDXL-handbag","seed":42,"resolution":1024,"center_crop":false,"train_text_encoder":false,"batch_size":1,"sample_batch_size":4,"epochs":1,"num_steps":500,"checkpointing_steps":100000,"resume_from_checkpoint":null,"gradient_accumulation":4,"disable_gradient_checkpointing":false,"lr":0.0001,"scale_lr":false,"scheduler":"constant","warmup_steps":0,"num_cycles":1,"lr_power":1.0,"dataloader_num_workers":0,"use_8bit_adam":false,"adam_beta1":0.9,"adam_beta2":0.999,"adam_weight_decay":0.01,"adam_epsilon":1e-8,"max_grad_norm":1.0,"allow_tf32":false,"prior_generation_precision":null,"local_rank":-1,"xformers":false,"pre_compute_text_embeddings":false,"tokenizer_max_length":null,"text_encoder_use_attention_mask":false,"rank":4,"xl":true,"fp16":true,"bf16":false,"token":"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","repo_id":"vardhanam/handbag_sdxl_lora","push_to_hub":true,"username":null,"validation_prompt":null,"num_validation_images":4,"validation_epochs":50,"checkpoints_total_limit":null,"validation_images":null,"logging":false}
> INFO    ['python', '-m', 'autotrain.trainers.dreambooth', '--training_config', 'Dreambooth-SDXL-handbag/training_params.json']
WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for:
    PyTorch 2.1.0+cu121 with CUDA 1201 (you have 2.2.1+cu121)
    Python  3.10.13 (you have 3.10.0)
...
?? INFO  | 2024-02-23 13:21:40 | autotrain.trainers.dreambooth.trainer:__init__:132 -  Training config = {'model': 'stabilityai/stable-diffusion-xl-base-1.0', 'revision': None, 'tokenizer': None, 'image_path': 'Dreambooth-SDXL-handbag/autotrain-data/concept1', 'class_image_path': None, 'prompt': 'A photo of brown_handbag_1234', 'class_prompt': None, 'num_class_images': 100, 'class_labels_conditioning': None, 'prior_preservation': False, 'prior_loss_weight': 1.0, 'project_name': 'Dreambooth-SDXL-handbag', 'seed': 42, 'resolution': 1024, 'center_crop': False, 'train_text_encoder': False, 'batch_size': 1, 'sample_batch_size': 4, 'epochs': 500, 'num_steps': 500, 'checkpointing_steps': 100000, 'resume_from_checkpoint': None, 'gradient_accumulation': 4, 'disable_gradient_checkpointing': False, 'lr': 0.0001, 'scale_lr': False, 'scheduler': 'constant', 'warmup_steps': 0, 'num_cycles': 1, 'lr_power': 1.0, 'dataloader_num_workers': 0, 'use_8bit_adam': False, 'adam_beta1': 0.9, 'adam_beta2': 0.999, 'adam_weight_decay': 0.01, 'adam_epsilon': 1e-08, 'max_grad_norm': 1.0, 'allow_tf32': False, 'prior_generation_precision': None, 'local_rank': -1, 'xformers': False, 'pre_compute_text_embeddings': False, 'tokenizer_max_length': None, 'text_encoder_use_attention_mask': False, 'rank': 4, 'xl': True, 'fp16': True, 'bf16': False, 'token': '*****', 'repo_id': 'vardhanam/handbag_sdxl_lora', 'push_to_hub': True, 'username': None, 'validation_prompt': None, 'num_validation_images': 4, 'validation_epochs': 50, 'checkpoints_total_limit': None, 'validation_images': None, 'logging': False}
Steps: 100%|█████████| 500/500 [50:28<00:00,  6.14s/it, loss=0.00574, lr=0.0001]Model weights saved in Dreambooth-SDXL-handbag/pytorch_lora_weights.safetensors
Steps: 100%|█████████| 500/500 [50:28<00:00,  6.06s/it, loss=0.00574, lr=0.0001]
pytorch_lora_weights.safetensors: 100%|████| 23.4M/23.4M [00:03<00:00, 6.97MB/s]


        

With the training complete, we can now use our fine-tuned adapters to begin inferencing.

First, load the base model and create an image generation pipeline:


from diffusers import DiffusionPipeline, AutoencoderKL
import torch

vae = AutoencoderKL.from_pretrained(
    "madebyollin/sdxl-vae-fp16-fix",
    torch_dtype=torch.float16
)
pipe_handbag = DiffusionPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0",
    vae=vae,
    torch_dtype=torch.float16,
    variant="fp16",
    use_safetensors=True,
)
pipe_handbag.to("cuda");

        

Load the LoRA weights.


pipe_handbag.load_lora_weights('/home/vardhanam/sdxl_fine_tune/Dreambooth-SDXL-handbag/pytorch_lora_weights.safetensors')
        

Example 1


prompt = "a female model holding brown_handbag_1234 in her hands on a beach"
image = pipe_handbag(prompt=prompt, num_inference_steps=25, num_images_per_prompt = 4)


image_grid(image.images, 2, 2)


        

Example 2


prompt = "wide shot of brown_handbag_1234 displayed inside a glass container in a big shopping mall"


image = pipe_handbag(prompt=prompt, num_inference_steps=25, num_images_per_prompt = 4)
image_grid(image.images, 2, 2)

        

Example 3


prompt = "brown_handbag_1234 placed on a table inside the living room of a house with furniture"


image = pipe_handbag(prompt=prompt, num_inference_steps=25, num_images_per_prompt = 4)
image_grid(image.images, 2, 2)


        

Use Case 3: Fine-Tuning on a Male Model Images



import glob
imgs = [Image.open(path) for path in glob.glob("Male_Model/*.jpg")]


image_grid(imgs, 2, 3)

        

These are the input images for fine-tuning SDXL.

Command to train.


!autotrain dreambooth \
--model 'stabilityai/stable-diffusion-xl-base-1.0' \
--project-name 'Dreambooth-SDXL-Male-Model' \
--image-path '/home/vardhanam/sdxl_fine_tune/Male_Model' \
--prompt "A photo of male_model_xyz" \
--resolution 1024 \
--batch-size 1 \
--num-steps 500 \
--gradient-accumulation 4 \
--lr 1e-4 \
--fp16 \
--push-to-hub \
--token ''YOUR_HF_TOKEN' \
--repo-id 'vardhanam/male_model_xyz_sdxl_lora'


> INFO    Namespace(version=False, revision=None, tokenizer=None, image_path='/home/vardhanam/sdxl_fine_tune/Male_Model', class_image_path=None, prompt='A photo of male_model_xyz', class_prompt=None, num_class_images=100, class_labels_conditioning=None, prior_preservation=None, prior_loss_weight=1.0, resolution=1024, center_crop=None, train_text_encoder=None, sample_batch_size=4, num_steps=500, checkpointing_steps=100000, resume_from_checkpoint=None, scale_lr=None, scheduler='constant', warmup_steps=0, num_cycles=1, lr_power=1.0, dataloader_num_workers=0, use_8bit_adam=None, adam_beta1=0.9, adam_beta2=0.999, adam_weight_decay=0.01, adam_epsilon=1e-08, max_grad_norm=1.0, allow_tf32=None, prior_generation_precision=None, local_rank=-1, xformers=None, pre_compute_text_embeddings=None, tokenizer_max_length=None, text_encoder_use_attention_mask=None, rank=4, xl=None, fp16=True, bf16=None, validation_prompt=None, num_validation_images=4, validation_epochs=50, checkpoints_total_limit=None, validation_images=None, logging=None, train=None, deploy=None, inference=None, username=None, backend='local-cli', token='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', repo_id='vardhanam/male_model_xyz_sdxl_lora', push_to_hub=True, model='stabilityai/stable-diffusion-xl-base-1.0', project_name='Dreambooth-SDXL-Male-Model', seed=42, epochs=1, gradient_accumulation=4, disable_gradient_checkpointing=None, lr=0.0001, log='none', data_path=None, train_split='train', valid_split=None, batch_size=1, func=)
> INFO    Running DreamBooth Training
> WARNING Parameters supplied but not used: train, inference, deploy, data_path, backend, log, train_split, valid_split, func, version
> INFO    Dataset: Dreambooth-SDXL-Male-Model (dreambooth)

> INFO    Saving concept images
> INFO    /home/vardhanam/sdxl_fine_tune/Male_Model/man-8017574.jpg
> INFO    Saving concept images
> INFO    /home/vardhanam/sdxl_fine_tune/Male_Model/man-8017568.jpg
> INFO    Saving concept images
> INFO    /home/vardhanam/sdxl_fine_tune/Male_Model/man-8017576.jpg
> INFO    Saving concept images
> INFO    /home/vardhanam/sdxl_fine_tune/Male_Model/man-8017562.jpg
> INFO    Saving concept images
> INFO    /home/vardhanam/sdxl_fine_tune/Male_Model/man-8017641.jpg
> INFO    Saving concept images
> INFO    /home/vardhanam/sdxl_fine_tune/Male_Model/man-8017599.jpg
> INFO    Starting local training...
> INFO    {"model":"stabilityai/stable-diffusion-xl-base-1.0","revision":null,"tokenizer":null,"image_path":"Dreambooth-SDXL-Male-Model/autotrain-data","class_image_path":null,"prompt":"A photo of male_model_xyz","class_prompt":null,"num_class_images":100,"class_labels_conditioning":null,"prior_preservation":false,"prior_loss_weight":1.0,"project_name":"Dreambooth-SDXL-Male-Model","seed":42,"resolution":1024,"center_crop":false,"train_text_encoder":false,"batch_size":1,"sample_batch_size":4,"epochs":1,"num_steps":500,"checkpointing_steps":100000,"resume_from_checkpoint":null,"gradient_accumulation":4,"disable_gradient_checkpointing":false,"lr":0.0001,"scale_lr":false,"scheduler":"constant","warmup_steps":0,"num_cycles":1,"lr_power":1.0,"dataloader_num_workers":0,"use_8bit_adam":false,"adam_beta1":0.9,"adam_beta2":0.999,"adam_weight_decay":0.01,"adam_epsilon":1e-8,"max_grad_norm":1.0,"allow_tf32":false,"prior_generation_precision":null,"local_rank":-1,"xformers":false,"pre_compute_text_embeddings":false,"tokenizer_max_length":null,"text_encoder_use_attention_mask":false,"rank":4,"xl":true,"fp16":true,"bf16":false,"token":"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","repo_id":"vardhanam/male_model_xyz_sdxl_lora","push_to_hub":true,"username":null,"validation_prompt":null,"num_validation_images":4,"validation_epochs":50,"checkpoints_total_limit":null,"validation_images":null,"logging":false}
> INFO    ['python', '-m', 'autotrain.trainers.dreambooth', '--training_config', 'Dreambooth-SDXL-Male-Model/training_params.json']
You are using a model of type clip_text_model to instantiate a model of type . This is not supported for all configurations of models and can yield errors.
You are using a model of type clip_text_model to instantiate a model of type . This is not supported for all configurations of models and can yield errors.
{'attention_type', 'dropout'} was not found in config. Values will be initialized to default values.
{'dynamic_thresholding_ratio', 'variance_type', 'thresholding', 'clip_sample_range'} was not found in config. Values will be initialized to default values.
?? INFO  | 2024-02-23 15:02:51 | autotrain.trainers.dreambooth.utils:enable_gradient_checkpointing:298 - Enabling gradient checkpointing.
?? INFO  | 2024-02-23 15:02:51 | autotrain.trainers.dreambooth.trainer:compute_text_embeddings:140 - Computing text embeddings for prompt: A photo of male_model_xyz
?? INFO  | 2024-02-23 15:02:52 | autotrain.trainers.dreambooth.trainer:__init__:124 - ***** Running training *****
?? INFO  | 2024-02-23 15:02:52 | autotrain.trainers.dreambooth.trainer:__init__:125 -  Num examples = 12
?? INFO  | 2024-02-23 15:02:52 | autotrain.trainers.dreambooth.trainer:__init__:126 -  Num batches each epoch = 12
?? INFO  | 2024-02-23 15:02:52 | autotrain.trainers.dreambooth.trainer:__init__:127 -  Num Epochs = 167
?? INFO  | 2024-02-23 15:02:52 | autotrain.trainers.dreambooth.trainer:__init__:128 -  Instantaneous batch size per device = 1
?? INFO  | 2024-02-23 15:02:52 | autotrain.trainers.dreambooth.trainer:__init__:129 -  Total train batch size (w. parallel, distributed & accumulation) = 4
?? INFO  | 2024-02-23 15:02:52 | autotrain.trainers.dreambooth.trainer:__init__:130 -  Gradient Accumulation steps = 4
?? INFO  | 2024-02-23 15:02:52 | autotrain.trainers.dreambooth.trainer:__init__:131 -  Total optimization steps = 500
?? INFO  | 2024-02-23 15:02:52 | autotrain.trainers.dreambooth.trainer:__init__:132 -  Training config = {'model': 'stabilityai/stable-diffusion-xl-base-1.0', 'revision': None, 'tokenizer': None, 'image_path': 'Dreambooth-SDXL-Male-Model/autotrain-data/concept1', 'class_image_path': None, 'prompt': 'A photo of male_model_xyz', 'class_prompt': None, 'num_class_images': 100, 'class_labels_conditioning': None, 'prior_preservation': False, 'prior_loss_weight': 1.0, 'project_name': 'Dreambooth-SDXL-Male-Model', 'seed': 42, 'resolution': 1024, 'center_crop': False, 'train_text_encoder': False, 'batch_size': 1, 'sample_batch_size': 4, 'epochs': 167, 'num_steps': 500, 'checkpointing_steps': 100000, 'resume_from_checkpoint': None, 'gradient_accumulation': 4, 'disable_gradient_checkpointing': False, 'lr': 0.0001, 'scale_lr': False, 'scheduler': 'constant', 'warmup_steps': 0, 'num_cycles': 1, 'lr_power': 1.0, 'dataloader_num_workers': 0, 'use_8bit_adam': False, 'adam_beta1': 0.9, 'adam_beta2': 0.999, 'adam_weight_decay': 0.01, 'adam_epsilon': 1e-08, 'max_grad_norm': 1.0, 'allow_tf32': False, 'prior_generation_precision': None, 'local_rank': -1, 'xformers': False, 'pre_compute_text_embeddings': False, 'tokenizer_max_length': None, 'text_encoder_use_attention_mask': False, 'rank': 4, 'xl': True, 'fp16': True, 'bf16': False, 'token': '*****', 'repo_id': 'vardhanam/male_model_xyz_sdxl_lora', 'push_to_hub': True, 'username': None, 'validation_prompt': None, 'num_validation_images': 4, 'validation_epochs': 50, 'checkpoints_total_limit': None, 'validation_images': None, 'logging': False}
Steps: 100%|█████████| 500/500 [58:04<00:00,  6.85s/it, loss=0.00341, lr=0.0001]Model weights saved in Dreambooth-SDXL-Male-Model/pytorch_lora_weights.safetensors
Steps: 100%|█████████| 500/500 [58:04<00:00,  6.97s/it, loss=0.00341, lr=0.0001]
pytorch_lora_weights.safetensors: 100%|████| 23.4M/23.4M [00:05<00:00, 4.16MB/s]


        

Let’s create a pipeline like before for inferencing.


from diffusers import DiffusionPipeline, AutoencoderKL
import torch

vae = AutoencoderKL.from_pretrained(
    "madebyollin/sdxl-vae-fp16-fix",
    torch_dtype=torch.float16
)
pipe_male_model = DiffusionPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0",
    vae=vae,
    torch_dtype=torch.float16,
    variant="fp16",
    use_safetensors=True,
)
pipe_male_model.to("cuda");

pipe_male_model.load_lora_weights('/home/vardhanam/sdxl_fine_tune/Dreambooth-SDXL-Male-Model/pytorch_lora_weights.safetensors')

        

Example 1


prompt = "Photo of male_model_xyz in a newsconference with lots of microphones and other technical equipment"


image = pipe_male_model(prompt=prompt, num_inference_steps=25, num_images_per_prompt = 4)
image_grid(image.images, 2, 2)

        

Example 2


prompt = "Photo of male_model_xyz wearing sunglasses and posing in a garden"


image = pipe_male_model(prompt=prompt, num_inference_steps=25, num_images_per_prompt = 4)
image_grid(image.images, 2, 2)

        


Example 3


prompt = "Photo of male_model_xyz playing football in sporting clothes"


image = pipe_male_model(prompt=prompt, num_inference_steps=25, num_images_per_prompt = 4)
image_grid(image.images, 2, 2)

        

Conclusion

Through this comprehensive tutorial, we have successfully demonstrated how to leverage DreamBooth and LoRA adapters to fine-tune the powerful SDXL model for tailored applications in advertising and entertainment media. By training specialized adapters on specific products and human subject images, we unlocked SDXL's ability to generate high-quality, bespoke visual content aligned with our prompts. The fine-tuned models reliably produced novel, creative images matching the target domain, while retaining SDXL's core artistic capabilities. With the right tuning, AI imaging models like SDXL can become versatile tools for enhancing ideation, personalization, and efficiency across the dynamic advertising and media landscape. This tutorial provides the blueprint for unlocking that potential.

Code

The complete code for this article can be accessed here: https://github.com/vardhanam/SDXL_finetune/tree/main

Arun Tomar

sr info international

7 个月

Sand your contact number

回复

要查看或添加评论,请登录

社区洞察

其他会员也浏览了