Skip to content

Move VLM training configs into examples/vlm/ - #193

Merged
amazloumi merged 6 commits into
mainfrom
refactor/vlm-configs-to-examples
Aug 26, 2026
Merged

Move VLM training configs into examples/vlm/#193
amazloumi merged 6 commits into
mainfrom
refactor/vlm-configs-to-examples

Conversation

@amazloumi

Copy link
Copy Markdown
Member

Summary

  • Move the 13 configs/train/vlm_*.toml presets to examples/vlm/configs/ (same filenames), so configs/train/ ships only general presets.
  • Add examples/vlm/train.py and examples/vlm/README.md. The script is deliberately thin (load_configrun_training): the VLM step body still lives in core, where run_training picks it from config.is_vlm, so no new seam was needed.
  • Move the shipped-config assertions to examples/vlm/tests/. The loader contract they touched (list[FreezeSpec] instantiation) was previously unasserted anywhere, so it is now pinned in core against an inline TOML.
  • [video].data_root in vlm_video_webvid.toml becomes a placeholder; the example's tests enforce that every config in the directory is machine-independent.
  • Repoint the eval how-to and harness usage strings at the moved paths; configs/train/vlm_jd.toml has never existed, so those examples now name a real config.
  • BREAKING: no shim or symlink — update any path naming configs/train/vlm_*.toml.

Testing

  • uv run ruff check kempnerforge/ tests/ scripts/ passes
  • uv run ruff format --check kempnerforge/ tests/ scripts/ passes — 167 files
  • uv run pyright kempnerforge/ passes (0 errors)
  • uv run pytest tests/unit/ -v --timeout=120 — 1725 passed, 3 skipped
  • uv run pytest examples/vlm/tests/ -v — 33 passed (all 13 configs load + validate; no machine-specific paths; entry point plumbs CLI overrides)
  • uv run pytest examples/vlm/eval/tests/unit -q — 104 passed
  • Reference sweep: git grep -n "configs/train/vlm_" returns only CHANGELOG history
  • New core test verified by mutation: with list[Dataclass] coercion disabled, test_vlm_freeze_list_instantiates_specs is the only core failure; the example's test_vlm_video_webvid_toml fails at its own assertion line
  • Real run at the new path (kempner_eng, H200): examples/vlm/train.py examples/vlm/configs/vlm_debug.toml --train.max_steps=20 → loss 11.00 → 8.56, step_20 committed. Also 2-GPU torchrun, dp_shard=2.
  • Resume drill at the new path: SIGTERM at step 352 → emergency step_352 → resume logs Resumed DataLoader: epoch=0, skip_batches=352 → 1648 post-resume steps identical to an uninterrupted 2000-step reference at logged precision (4 dp, num_workers=0), with a 352-step pre-interrupt control also identical
  • If training loop / parallelism / optimizers changed: n/a — no runtime core code changed

Closes #188

amazloumi and others added 3 commits August 26, 2026 10:30
The 13 configs/train/vlm_*.toml presets move to examples/vlm/configs/
under the same filenames, so the core configs/train/ tree ships only
general presets. BREAKING for any path naming the old location; no shim.

The example now owns its own entry point (examples/vlm/train.py) and a
README. The script is a thin argv -> load_config -> run_training wrapper:
the VLM step body still lives in core, where run_training selects it from
config.is_vlm, so no seam work was needed here.

The two tests that loaded the shipped VLM configs move to
examples/vlm/tests/ — they assert the example's contents, and a core test
must not depend on examples/. The loader contract they also happened to
cover (list[FreezeSpec] plus the parallel [vision_encoder]/[adapter]/[vlm]
tables) stays in tests/unit/test_config.py against an inline TOML.

[video].data_root in vlm_video_webvid.toml becomes a placeholder; shipped
example configs must be machine-independent, and the example's tests now
enforce that for every config in the directory.
The vlm_debug preset has no [adapter] table and no freeze key, so the
freeze assertions there restated a dataclass default and the docstring
described coverage the test did not have. vlm_video_webvid is the only
preset with both, so the list[FreezeSpec] check moves there.

Also repoints the eval how-to and harness usage strings at the moved
config paths; vlm_jd.toml has never existed, so those examples name
vlm_7b.toml.
@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
kempnerforge/model/vision.py 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…to-examples

Two conflicts from #190, which moved the COCO prep helper out of scripts/.

CHANGELOG: both BREAKING entries kept in the same Changed block.

configs/train/vlm_7b_siglip2.toml was a rename/modify — this branch moves
the file to examples/vlm/configs/, #190 edited its prep-helper comment.
Resolved by keeping both: the file lands at the new path carrying the
examples/vlm/data/prep_vlm_coco.py reference.

The example README gains a line for the data/ helper that #190 placed
alongside configs/, train.py, and eval/.
The core loader test declared freeze = [{vision_encoder, true}], which is
exactly VLMConfig.freeze's default_factory, so it passed whether or not the
loader read the TOML. It now declares two entries with non-default modules
and flags. FreezeSpec has no __post_init__, so the docstring no longer
claims one runs; what the test proves is that the entries become FreezeSpec
instances rather than staying raw dicts.
@amazloumi
amazloumi requested review from Naeemkh and mmshad August 26, 2026 19:34
Conflict in the freeze-schedule config: main pinned the FreezeStage hook
to training/loop.py while this branch had made the reference
location-neutral. Kept main's wording and this branch's moved paths.

@Naeemkh Naeemkh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@amazloumi
amazloumi merged commit b79e31d into main Aug 26, 2026
8 checks passed
@amazloumi
amazloumi deleted the refactor/vlm-configs-to-examples branch August 26, 2026 20:22
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.

Move VLM training configs into examples/vlm/

2 participants