LangSplatV2: Training pipeline for sparse language feature fields#53
Merged
swahtz merged 9 commits intoopenvdb:mainfrom Feb 12, 2026
Merged
LangSplatV2: Training pipeline for sparse language feature fields#53swahtz merged 9 commits intoopenvdb:mainfrom
swahtz merged 9 commits intoopenvdb:mainfrom
Conversation
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
Optimizations to feature loading and feature map creation Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
… memory traffic Remove topk_referesh_every optimization Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds the LangSplatV2 training pipeline to the langsplatv2 package, enabling learning per-Gaussian sparse language feature fields (decoded via shared codebooks) on top of a frozen fVDB Gaussian splat reconstruction.
Changes:
- Introduces
LangSplatV2Model, VQ/codebook initialization utilities, and masked CLIP-feature losses. - Adds dataset + dataloader utilities for compact CLIP feature storage and GPU-side dense feature map materialization.
- Implements a full training runner (init, train/eval loops, checkpointing) and a
tyro-based CLI entrypoint.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| open_vocabulary_segmentation/langsplatv2/train_langsplatv2.py | Adds CLI entrypoint for launching LangSplatV2 training. |
| open_vocabulary_segmentation/langsplatv2/testers/dataset_tester.py | Adds a local dataset smoke-test script (currently non-portable). |
| open_vocabulary_segmentation/langsplatv2/testers/data_tester.py | Adds a local preprocessing smoke-test script (currently non-portable). |
| open_vocabulary_segmentation/langsplatv2/pyproject.toml | Adds runtime deps needed for training (e.g., scikit-learn, tyro). |
| open_vocabulary_segmentation/langsplatv2/langsplatv2/vq_utils.py | Adds top-k soft code helper + RVQ K-means codebook initialization. |
| open_vocabulary_segmentation/langsplatv2/langsplatv2/util.py | Adds helpers for loading SfM scenes and GS reconstructions. |
| open_vocabulary_segmentation/langsplatv2/langsplatv2/training/trainer.py | Implements the end-to-end training runner (init/train/eval/checkpoint). |
| open_vocabulary_segmentation/langsplatv2/langsplatv2/training/dataset.py | Adds dataset + collate + GPU dense feature map builder + infinite sampler. |
| open_vocabulary_segmentation/langsplatv2/langsplatv2/training/init.py | Exposes training APIs from the package. |
| open_vocabulary_segmentation/langsplatv2/langsplatv2/model.py | Implements the LangSplatV2 model (render sparse weights, decode via codebooks). |
| open_vocabulary_segmentation/langsplatv2/langsplatv2/loss.py | Adds masked cosine/L1 losses for CLIP feature supervision. |
| open_vocabulary_segmentation/langsplatv2/langsplatv2/config.py | Extends configs with model + training dataclasses. |
| open_vocabulary_segmentation/langsplatv2/langsplatv2/init.py | Re-exports key configs/model/loss for package users. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
open_vocabulary_segmentation/langsplatv2/langsplatv2/training/trainer.py
Outdated
Show resolved
Hide resolved
open_vocabulary_segmentation/langsplatv2/langsplatv2/training/trainer.py
Show resolved
Hide resolved
open_vocabulary_segmentation/langsplatv2/langsplatv2/training/trainer.py
Outdated
Show resolved
Hide resolved
open_vocabulary_segmentation/langsplatv2/langsplatv2/training/trainer.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
…trainer.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
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
Implements the LangSplatV2 training pipeline for learning per-Gaussian sparse language feature fields using fVDB and fvdb-reality-capture. This builds on the preprocessing transforms already merged in #42, adding the model, loss, training loop, and supporting utilities needed to train language-aware Gaussian splats. closes #32
Key components:
model.py):LangSplatV2Modelwraps a frozenGaussianSplat3dwith learnable per-Gaussian logits and codebooks. Renders sparse coefficient weight maps via splatting and decodes them into dense CLIP feature maps through codebook lookup.vq_utils.py): Implementssoftmax_to_topk_soft_codefor efficient sparse coefficient generation andResidualVectorQuantizationfor K-means codebook initialization from ground-truth CLIP features.loss.py): Cosine similarity and L1 losses with per-pixel masking for regions without valid language features.training/dataset.py):LangSplatV2Datasetloads pre-computed CLIP features and segmentation maps in compact form. Dense ground-truth feature maps are materialized on-device after transfer usingbuild_feature_map, avoiding large CPU-to-GPU transfers.training/trainer.py):LangSplatV2Traininghandles the full workflow — dataset construction, K-means codebook initialization, optimizer setup, training/eval loops with gradient accumulation, and checkpointing.config.py): Extended withLangSplatV2ModelConfigandLangSplatV2TrainingConfigdataclasses.train_langsplatv2.py): CLI script usingtyrofor launching training.Performance optimizations
JaggedTensorfor variable-length per-image features, avoiding padding overheadbuild_feature_map) usingtorch.emptyto eliminate costly zero-fill of ~4 GB tensorsTest plan
python train_langsplatv2.py --scene-dir <path> --checkpoint-dir <path>