Multimmodal: add VLM foundation + Joint-Decoder arch#76
Merged
Conversation
# Conflicts: # CHANGELOG.md
Naeemkh
requested changes
May 1, 2026
Member
Naeemkh
left a comment
There was a problem hiding this comment.
Thanks, @amazloumi . While I am reviewing, please bring back the code coverage setup.
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| slug: KempnerInstitute/KempnerForge | ||
| - run: uv run pytest tests/unit/ -v --timeout=60 | ||
|
|
Member
There was a problem hiding this comment.
Please return back code coverage setup.
This was referenced May 1, 2026
Naeemkh
approved these changes
May 4, 2026
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.
Summary
Adds end-to-end VLM training to KempnerForge as a thin wrapper around the existing
Transformer. Image tokens come from a frozen HF vision encoder (SigLIP2, CLIP, or arandomtest stub), pass through a 2-layer adapter, and feed the backbone via an arch-specificModalityStrategyresolved through the registry.This PR ships the foundation plus the simplest concrete arch — Joint-Decoder (image embeds prepended to the text sequence, LM head applied to text positions only). The dispatch is registry-driven and discriminated on
[model.vlm].arch, so future arches (Cross-Attention, Mixture-of-Transformers) are small additive PRs without touching existing call sites. Both are listed in_RESERVED_ARCHS, so TOMLs aimed at them get a clearNotImplementedErroruntil they land.Default
model.vlm = Nonekeeps text-only training bit-equal to today; CI for non-VLM paths is unchanged.CI:
pytest-covfrom dev deps and the[tool.coverage]blocks (consistent with the README's codecov badge removal);.github/workflows/ci.ymlno longer runs--covor uploads to CodecovTesting
ruff check kempnerforge/ tests/ scripts/— cleanruff format --check kempnerforge/ tests/ scripts/— cleanpyright kempnerforge/— 0 errors / 0 warningspytest tests/unit/ tests/integration/— 1066 passed, 1 skipped (single GPU)torchrun --nproc_per_node=2 -m pytest tests/distributed/— 65 passed, 8 skipped on 2× H200tests/distributed/test_vlm_fsdp.py(6 cases): 2-GPU build + forward, FSDP-sharded grads flow, variable-length rank consistency, dtype combinatorics (encoder fp32 / adapter+transformer bf16),inner_transformerundertorch.compile+ FSDP2, DCP checkpoint round-trip with freeze metadata.Follow-ups (separate PRs)
CrossAttentionConfig+CrossAttentionBlock+CrossAttentionStrategy. Llama-3-V style: residual stream stays text-only; image K/V flows into separate CA blocks at a configurable cadence. Reserved in_RESERVED_ARCHShere.MoTConfig+MoTBlock+MoTStrategy+ JD→MoT warm-start helper. Per-modality Q/K/V/O + per-modality FFN at every layer, single global SDPA. Reserved in_RESERVED_ARCHShere.