Skip to content

feat: add caption_extension, GPU arch check, 8GB config, and tests - #8

Open
wilsontr wants to merge 1 commit into
TensorHarmony:mainfrom
wilsontr:feat/caption-extension-gpu-check
Open

feat: add caption_extension, GPU arch check, 8GB config, and tests#8
wilsontr wants to merge 1 commit into
TensorHarmony:mainfrom
wilsontr:feat/caption-extension-gpu-check

Conversation

@wilsontr

Copy link
Copy Markdown

Summary

  • caption_extension: Adds per-image sidecar caption support to DreamBoothDataset. When caption_extension: ".txt" is set in the config, the dataset reads same-name .txt files alongside each image for tag-based LoRA training (Illustrious-style), falling back to instance_prompt when no sidecar exists.

  • GPU arch check: Early startup check that compares the GPU's compute capability against PyTorch's compiled architectures. Raises a clear RuntimeError with actionable fix instructions instead of failing cryptically during model loading (e.g., Blackwell sm_120 on a cu126 PyTorch build).

  • 8GB example config: New config/examples/train_lora_sdxl_8gb_1.0.yaml using 4-bit NF4 QLoRA, 768px resolution, 8-bit AdamW, gradient checkpointing, and latent caching.

  • Tests: 7 passing tests covering sidecar loading edge cases and GPU arch check behavior (pytest>=8.0 added to dev dependencies).

  • README: Documented caption_extension, 8GB config, and Blackwell GPU troubleshooting.

Changes

File Lines
src/lorakit/datasets.py +19
src/lorakit/train.py +16
tests/test_datasets.py +116 (new)
tests/test_train.py +77 (new)
config/examples/train_lora_sdxl_8gb_1.0.yaml +85 (new)
README.md +17
pyproject.toml +1

datasets.py:
- Add `caption_extension` parameter to DreamBoothDataset for loading
  per-image captions from sidecar .txt files. Applies dataset repeats
  to captions for correct index alignment.

train.py:
- Parse `caption_extension` from config and pass it through to the dataset.
- Add early GPU compute capability check at startup. If the installed
  PyTorch build does not include kernels for the current GPU (e.g.
  Blackwell sm_120), raise a RuntimeError with a clear fix message
  instead of failing cryptically during model loading.

tests:
- test_datasets.py: 5 tests covering sidecar loading, missing sidecars,
  empty sidecars, caption_extension disabled, and repeat alignment.
- test_train.py: 2 tests for the GPU arch check (unsupported raises,
  supported passes).

config/examples/train_lora_sdxl_8gb_1.0.yaml:
- New 8GB VRAM config using 4-bit NF4 QLoRA, 768px resolution, 8-bit
  AdamW, gradient checkpointing, and latent caching. Demonstrates
  caption_extension usage.

README.md:
- Document caption_extension feature and sidecar file format.
- Add 8GB config to the config table.
- Add Blackwell GPU troubleshooting entry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant