How to Build and Caption a LoRA Training Dataset on a Mac
sips command and draft the captions with a local vision model, so the whole dataset can be made from the terminal without uploading anything.
Why the Dataset Matters More Than the Settings
So when a LoRA comes out bad, people reach for the settings first, the learning rate, the rank, the step count. Most of the time the problem is the images. The model learns whatever your images have in common, and it has no idea which common thing you meant. If all 20 photos of your dog are on the same couch, the couch is part of the dog as far as the LoRA knows, and it will put that couch in the desert, on the moon and underwater.
So the whole job comes down to 1 rule: keep the thing you want learned the same in every image, and change everything else. Same subject, different backgrounds, different lighting, different angles, different distances. A dataset basically means "here is the 1 thing that does not change", and the captions are how you tell the model what the changing parts are so it does not blame them on your subject.
How Many Images You Need
Fewer than people think. For 1 person, character, pet or product, 15 to 30 good images is the normal range, and 10 can work if they are varied. For an art style, 30 to 60 is better, because a style has to be learned across many different subjects before the model stops copying the subjects themselves. More than 100 rarely helps a simple LoRA and makes training take longer.
20 strong images beat 60 mixed ones every time. Every weak image you add, blurry, badly cropped, heavily filtered, teaches the LoRA that blur, bad crops and filters are part of the subject.
Step by Step
sips ships with macOS, and -Z 1024 scales each image so its longest side is 1024 pixels while keeping the shape.
mkdir -p ~/my-lora/images
cp ~/Pictures/lora-picks/* ~/my-lora/images/
cd ~/my-lora/images
# rename to 01.jpg, 02.jpg, ...
n=1
for f in *.jpg *.jpeg *.png; do
[ -e "$f" ] || continue
ext="${f##*.}"
mv "$f" "$(printf '%02d' $n).$ext"
n=$((n+1))
done
# cap the long side at 1024 pixels
sips -Z 1024 *.jpg *.jpeg *.png
If you have HEIC photos from an iPhone, convert them first, since trainers expect PNG, JPG or WEBP:
for f in *.HEIC; do sips -s format jpeg "$f" --out "${f%.HEIC}.jpg"; done
You do not need to crop everything to a square. Modern trainers handle mixed shapes, and keeping some wide and some tall images helps the LoRA work at different output sizes. What you should crop is anything where the subject is small in the frame, cut in closer so the subject fills a good part of the picture.
zxq or ohwx works, a real word like "max" or "bella" does not, the model already has thousands of pictures in its head for those.
Put a class word right after it, the plain category the subject belongs to: zxq dog, zxq woman, zxq sneaker. The class word lets the LoRA borrow everything the model already knows about dogs or sneakers and only learn what makes yours different. For a style LoRA the trigger describes the look, like in zxq style.
01.jpg gets 01.txt. Write 1 plain sentence: the trigger and class word, then what is going on in the picture.
echo "a photo of zxq dog sitting on a wooden porch, late afternoon sun, looking at the camera" > 01.txt
echo "a close up photo of zxq dog lying on green grass, tongue out, blurred trees behind" > 02.txt
The rule that surprises people is what to leave out. Describe everything you want to be able to change later, the background, the lighting, the pose, the clothes. Do not describe the features that define the subject. If your dog has 1 white ear and you write "with one white ear" in every caption, you have told the model the white ear is a separate optional thing, and it will only show up when you ask. Leave it out and it becomes part of what zxq dog means.
For a style LoRA it flips. Describe the content of each image in full, the people, objects and scene, and say nothing about the style except the trigger. Then the style is the 1 thing left over for the trigger to absorb.
Drafting Captions With a Local Vision Model
Writing 30 captions by hand takes maybe 20 minutes. If you would sooner have the Mac draft them, mlx-vlm runs vision models locally, the same family of tools mflux is built on. Install it and test it on 1 image:
pip install -U mlx-vlm
mlx_vlm.generate \
--model mlx-community/Qwen2-VL-2B-Instruct-4bit \
--max-tokens 100 \
--temperature 0.0 \
--image 01.jpg \
--prompt "Describe this photo in one plain sentence. Mention the setting, lighting and pose."
That small 2B model is light enough for a 16 GB Mac. A bigger vision model writes better captions if you have the memory for it. The command prints its answer to the terminal along with some run details, so the simplest reliable workflow is to run it per image, read what it wrote, and paste the sentence into the matching text file with your trigger word added at the front. It is slower than a fully automated loop, and it forces the review that step 5 asks for anyway.
# list any image that has no caption file
for f in *.jpg *.png; do [ -e "${f%.*}.txt" ] || echo "missing caption: $f"; done
# confirm the trigger word is in every caption
grep -L "zxq" *.txt
echo "a photo of zxq dog wearing a red scarf, standing in deep snow" > preview_1.txt
echo "a watercolor painting of zxq dog on a sailboat" > preview_2.txt
What the Finished Folder Looks Like
my-lora/
images/
01.jpg 01.txt
02.jpg 02.txt
...
24.png 24.txt
preview_1.txt
preview_2.txt
That folder is ready for training a LoRA on a Mac, the config file points at it with "data": "images/".
The Mistakes That Cost the Most
The same background or outfit in most images. It gets baked in. If you cannot get variety, at least describe the repeated thing in every caption so the model has a chance of separating it.
Other people or pets in the frame. The LoRA cannot tell which one is the subject. Crop them out or drop the image.
Heavy filters, beauty modes and upscaled images. The LoRA learns the filter. Use the plainest, sharpest originals you have.
Mixing ages or looks. Photos of a person across 15 years average into someone who does not exist. Keep to 1 period and 1 general look.
Images you do not have the rights to. Training a style on a living artist's work, or a LoRA of a real person without their permission, is a legal and ethical problem that the tool will not stop you from creating. Use your own photos, your own art, or images you are licensed to use.