Add C-RADIO as a teacher#33
Open
abtonmoy wants to merge 1 commit into
Open
Conversation
Adds a cradio.py extractor mirroring the existing teachers, wired into get_model / get_feature_outputs / common.py, plus cradio and cddsvr target-model configs. Translator heads are sized from MODEL_FEATURE_SIZES, so no architecture changes are needed.
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 C-RADIO (
nvidia/C-RADIOv3-H) as a distillation teacher.C-RADIO is an agglomerative (multi-teacher-distillation) VFM whose weights are under the NVIDIA Open Model License, which permits commercial use — so it works as a default teacher. It fits the existing setup directly: translator heads are sized from
MODEL_FEATURE_SIZES, so it slots in with no architecture changes.Changes
foundation_models/vision_models/cradio.py—get_cradio_model/get_cradio_feature, mirroring the existing teacher modules. Input conditioning is handled internally by C-RADIO (pixels passed in[0, 1]); a forward pass returns(summary, spatial_features), reshaped to(B, C, H, W).foundation_models/__init__.py— export the two functions.preprocessing/feature_extraction_core/models.py— dispatch branches inget_modelandget_feature_outputs.foundation_models/common.py— addnvidia/C-RADIOv3-HtoMODELSandMODEL_FEATURE_SIZES((1280, 14, 14)).configs/training/target_models/cradio.yaml— C-RADIO as a single teacher.configs/training/target_models/cddsvr.yaml— the existingcddsvfull set plus C-RADIO.Testing
Verified locally on a single GPU:
AutoModel.from_pretrained("nvidia/C-RADIOv3-H", trust_remote_code=True); spatial features are(1280, 14, 14)at 224 input, matching the registered size.Notes
scripts/preprocessing/calc_feature_mean.py, as documented for the other teachers. Happy to commit the.npyfiles if you'd prefer them in-tree.nvidia/C-RADIOv3-H) and config naming are easy to change if you'd prefer a different variant or convention.C-RADIO'strust_remote_codepath pulls intimm,einops, andopen_clip_torch; I can add these to the dependencies if you'd like.