Add sd lora data container and preprocessing funcs#2281
Merged
xiaoyu-work merged 8 commits intomainfrom Dec 19, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
lintrunner found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
shaahji
previously approved these changes
Dec 15, 2025
ce47f87 to
7ef866a
Compare
…has a side-effect Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…has a side-effect Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
shaahji
approved these changes
Dec 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new
sd_loradata component to the Olive data pipeline, adding advanced image preprocessing and auto-captioning capabilities for Stable Diffusion LoRA training. The main changes include registering the new component, implementing aspect ratio bucketing for efficient batching, and supporting automatic image captioning using BLIP-2 and Florence-2 models.New SD LoRA Data Component:
sd_loramodule inolive.data.component.__init__.py, making it available for import and use in the Olive data pipeline.sd_lorapackage to ensure proper licensing.Image Preprocessing Enhancements:
aspect_ratio_bucketinginsd_lora/aspect_ratio_bucketing.py, which automatically assigns images to buckets based on aspect ratio and resolution, supporting resizing and cropping for efficient Stable Diffusion training. Includes utilities for bucket generation, image resizing, and crop coordinate calculation.Auto-Captioning Support:
auto_caption,blip2_caption, andflorence2_captionpreprocessing functions insd_lora/auto_caption.py, enabling automatic image captioning using BLIP-2 and Florence-2 models. Supports batch processing, device selection, overwrite logic, and flexible caption storage (file or in-memory).These additions significantly enhance Olive's data preparation workflow for image generation and LoRA fine-tuning tasks.## Describe your changes
Checklist before requesting a review
lintrunner -a(Optional) Issue link