LORA Data Tool - Builder & Auditor for Linux & Mac by Sarcastic TOFU
Details
Download Files
Model description
I developed this LORA Data Tool as a simple, all-in-one stand alone application designed to prepare high-quality images and captions Datasets for training custom LORA models (For SDXL 1.0, Flux, Z-Image, Chroma & QWEN Image) on base level Apple Silicon Mac or on a Linux computer (works on both Nvidia and AMD GPUs/eGPUs.. even on 8GB VRAM). It uses the Florence-2 AI model for automated captioning and provides a gallery view for review and editing. The Florence-2 model is very compact and works well on low end GPUs as compared to regular beefy JoyCaption model. I don't use any Windows computer so I didn't build any setup script for Windows but as the LORA DATA tool is written in Python it can also be run easily on Windows if you know how to setup and run Python virtual environment on Windows. The tool has a very easy to follow user interface with two sections (Dataset builder & Dataset auditor) each section has it's own dedicated tab. You can either copy the path to the folder you have containing your images you wish to process or select using built in file browse & select UI to start your process on your relavant tab. These are the two tabs -
I. Data Builder (Automate)
---------------------------
The main tab for bulk processing your dataset.
Key Features:
- Image Scaling: Resizes images so the shortest side is 1024 pixels. New images are saved to a subfolder named '1024_scaled'.
- Caption Generation: Uses the Florence-2 AI model to automatically generate a detailed caption (saved as a .txt file) for each image.
- Caption Styles: Supports Short, Medium, and Long (Civitai Max) caption styles.
- Bulk Trigger Word: Adds a specified trigger word to the start or end of all generated/existing captions.
- Bulk Search & Replace: Replaces all occurrences of a search term with a replacement term across all caption files.
II. Data Auditor (Review)
--------------------------
The quality control tab for reviewing and manually adjusting the training data because AI captioning is very good but not always accurate.
Key Features:
- Page-Based Gallery: Loads and displays images and their corresponding captions in batches (10 items per page).
- Live Editing: Allows direct editing of the caption text next to the image preview.
- Save: Saves the edited captions for the current page.
- Delete: Permanently deletes both the image and its caption file.
III. Setup and Launch (Default AMD GPU Linux Setup or Apple Silicon Macs - M2, M4 etc.)
----------------------------------------------------------------------------------------
The tool relies on the 'run_linux.sh' or 'run_mac.sh' script for environment and model management.
1. Launch: Run the script appropriate for your operating system.
2. Dependencies: The script automatically creates a Python virtual environment ('venv') and installs required libraries (transformers, etc.).
3. Model: The script downloads the 'MiaoshouAI/Florence-2-base-PromptGen-v1.5' model (~1.3 GB) into a 'model' subfolder during the first run.
4. Clean Operation: To remove the environment and model, run the script with the '--clean' argument:
- Linux: ./run_linux.sh --clean
- macOS: ./run_mac.sh --clean
** NVIDIA / CUDA Setup (Linux) modificatins (Very Important - without this the setup will fail)
------------------------------------------------------------------------------------------------
By default, 'run_linux.sh' is configured for AMD (ROCm). To use an NVIDIA GPU:
1. Open 'run_linux.sh' in a text editor.
2. Find the line that installs torch (usually Step 3).
3. Replace the pip3 install command with the following:
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu121
4. Save the file and run it. This will ensure the tool uses your NVIDIA GPU for
lightning-fast caption generation.
5. Clean Operation: To remove the environment and model, run the script with the '--clean' argument:
- Linux: ./run_linux.sh --clean
** With this tool I also provided 60 royaly free images from Unsplash as a free sample dataset to test out this tool's capability. If you are looking for good uncaptioned datasets to train but finding it difficult to collect your own you can also look up my CivitAI profile ( https://civitai.com/user/sarcastictofu ) I have uplodead some decent datasets there. Feel free to download them and if you like any of my work please provide me some Buzz.



