Run this model with HF Jobs
Run nvidia/C-RADIOv2-g on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/nvidia/C-RADIOv2-g. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/nvidia/C-RADIOv2-g on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use nvidia/C-RADIOv2-g with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nvidia/C-RADIOv2-g with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-feature-extraction", model="nvidia/C-RADIOv2-g", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("nvidia/C-RADIOv2-g", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload model
#2
by gheinrich - opened
Files changed (4)
- common.py+7
- config.json+20-33
- extra_timm_models.py+16-6
- model.safetensorsAdded+3
58 unmodified lines59606162636458 unmodified linespreferred_resolution=(896, 896),vitdet_num_global=8,),# RADIO"radio_v2.1": RadioResource("https://huggingface.co/nvidia/RADIO/resolve/main/radio_v2.1_bf16.pth.tar?download=true",58 unmodified lines5960616263646566676869707158 unmodified linespreferred_resolution=(896, 896),vitdet_num_global=8,),"c-radio_v2.5-g": RadioResource("https://huggingface.co/nvidia/RADIO/resolve/main/radio_v2.5-g.pth.tar?download=true",patch_size=16,max_resolution=2048,preferred_resolution=(768, 768),vitdet_num_global=8,),# RADIO"radio_v2.1": RadioResource("https://huggingface.co/nvidia/RADIO/resolve/main/radio_v2.1_bf16.pth.tar?download=true",
15 unmodified lines161718192021222 unmodified lines252627282930313226 unmodified lines596061626364658 unmodified lines747576777879808124 unmodified lines10610710810911011111211311411521 unmodified lines13713813914014114214314414514622 unmodified lines16917017117217317417517617717817918018118218318418518618718818919019119219319419519619732 unmodified lines23023123223323423523623723823924024124224315 unmodified lines"cache_dir": null,"channels_last": false,"checkpoint_hist": 10,"chk_keep_forever": 100,"class_map": "","clip_grad": null,"clip_mode": "norm",2 unmodified lines"coco_image_dir": "/datasets/coco2017-adlsa/val2017","color_jitter": 0.4,"cooldown_epochs": 0,"cpe_max_size": 1792,"cpe_num_registers": 4,"crd_loss": false,"crd_loss_weight": 0.8,"crop_pct": null,26 unmodified lines"eval_throughput": false,"fast_norm": false,"fd_loss_fn": "MSE","feature_normalization": "SHIP_NORM","feature_summarizer": "cls_token","feature_upscale_factor": null,"force_new_wandb_id": false,8 unmodified lines"head_init_bias": null,"head_init_scale": null,"head_lr": null,"head_warmup": 0,"head_weight_decay": 0.2,"hflip": 0.5,"img_size": null,"in_chans": null,24 unmodified lines"mixup_off_epoch": 0,"mixup_prob": 1.0,"mixup_switch_prob": 0.5,"mlp_hidden_size": 3328,"mlp_num_inner": 2,"mlp_version": "v2","model": "vit_bigG_patch14_224","model_kwargs": {},"model_norm": false,"momentum": 0.9,21 unmodified lines],"recount": 1,"recovery_interval": 0,"register_multiple": 0,"remode": "pixel","reprob": 0.0,"reset_loss_state": false,"resplit": false,"sample_tracking": false,"save_images": false,22 unmodified lines"model": "ViT-H-14-378-quickgelu","name": "clip","pretrained": "dfn5b","type": "open_clip"},{"feature_distillation": true,"input_size": 448,"name": "paligemma-448","type": "paligemma","use_summary": false},{"fd_normalize": false,"feature_distillation": true,"input_size": 378,"model": "dinov2_vitg14_reg","name": "dino_v2","type": "dino_v2"},{"feature_distillation": true,"input_size": 378,"name": "aimv2","type": "aimv2","use_summary": false},{"fd_normalize": false,32 unmodified lines},"feature_normalizer_config": null,"inter_feature_normalizer_config": null,"max_resolution": 1792,"patch_size": 14,"preferred_resolution": [896,896],"torch_dtype": "float32","transformers_version": "4.47.0.dev0","version": "radio_v2.5-g","vitdet_window_size": null}15 unmodified lines161718192021222 unmodified lines2526272829303126 unmodified lines585960616263648 unmodified lines737475767778798024 unmodified lines10510610710810911011111211311421 unmodified lines13613713813914014114214314414522 unmodified lines16816917017117217317417517617717817918018118218318432 unmodified lines21721821922022122222322422522622722822923015 unmodified lines"cache_dir": null,"channels_last": false,"checkpoint_hist": 10,"chk_keep_forever": 50,"class_map": "","clip_grad": null,"clip_mode": "norm",2 unmodified lines"coco_image_dir": "/datasets/coco2017-adlsa/val2017","color_jitter": 0.4,"cooldown_epochs": 0,"cpe_max_size": 2048,"crd_loss": false,"crd_loss_weight": 0.8,"crop_pct": null,26 unmodified lines"eval_throughput": false,"fast_norm": false,"fd_loss_fn": "MSE","feature_normalization": "PHI_STANDARDIZE","feature_summarizer": "cls_token","feature_upscale_factor": null,"force_new_wandb_id": false,8 unmodified lines"head_init_bias": null,"head_init_scale": null,"head_lr": null,"head_warmup": 5,"head_weight_decay": 0.03,"hflip": 0.5,"img_size": null,"in_chans": null,24 unmodified lines"mixup_off_epoch": 0,"mixup_prob": 1.0,"mixup_switch_prob": 0.5,"mlp_hidden_size": 1520,"mlp_num_inner": 1,"mlp_version": "v2","model": "vit_giant_patch16_224","model_kwargs": {},"model_norm": false,"momentum": 0.9,21 unmodified lines],"recount": 1,"recovery_interval": 0,"register_multiple": 8,"remode": "pixel","reprob": 0.0,"reset_loss_state": true,"resplit": false,"sample_tracking": false,"save_images": false,22 unmodified lines"model": "ViT-H-14-378-quickgelu","name": "clip","pretrained": "dfn5b","type": "open_clip","use_summary": true},{"fd_normalize": false,"feature_distillation": true,"input_size": 448,"model": "dinov2_vitg14_reg","name": "dino_v2","type": "dino_v2","use_summary": true},{"fd_normalize": false,32 unmodified lines},"feature_normalizer_config": null,"inter_feature_normalizer_config": null,"max_resolution": 2048,"patch_size": 16,"preferred_resolution": [768,768],"torch_dtype": "float32","transformers_version": "4.47.0.dev0","version": "c-radio_v2.5-g","vitdet_window_size": null}
23 unmodified lines242526272829302 unmodified lines333435363738393 unmodified lines434445464748492 unmodified lines525354555657586 unmodified lines656667686970712 unmodified lines74757677787980818219 unmodified lines10210310423 unmodified linesdef vit_tiny_patch14_224(pretrained=False, **kwargs) -> VisionTransformer:""" ViT-Tiny (Vit-Ti/16)"""model_args = dict(patch_size=14, embed_dim=192, depth=12, num_heads=3)model = _create_vision_transformer('vit_tiny_patch14_224', pretrained=pretrained, **dict(model_args, **kwargs))return model2 unmodified linesdef vit_small_patch14_224(pretrained=False, **kwargs) -> VisionTransformer:""" ViT-Small (ViT-S/16)"""model_args = dict(patch_size=14, embed_dim=384, depth=12, num_heads=6)model = _create_vision_transformer('vit_small_patch16_224', pretrained=pretrained, **dict(model_args, **kwargs))return model3 unmodified lines""" ViT-Base (ViT-B/14) from original paper (https://arxiv.org/abs/2010.11929).ImageNet-1k weights fine-tuned from in21k @ 224x224, source https://github.com/google-research/vision_transformer."""model_args = dict(patch_size=14, embed_dim=768, depth=12, num_heads=12)model = _create_vision_transformer('vit_base_patch14_224', pretrained=pretrained, **dict(model_args, **kwargs))return model2 unmodified linesdef vit_huge_patch16_224(pretrained=False, **kwargs) -> VisionTransformer:""" ViT-Huge model (ViT-H/16) from original paper (https://arxiv.org/abs/2010.11929)."""model_args = dict(patch_size=16, embed_dim=1280, depth=32, num_heads=16)if pretrained:# There is no pretrained version of ViT-H/16, but we can adapt a ViT-H/14 for this purposemodel = _create_vision_transformer('vit_huge_patch14_224', pretrained=True, **dict(model_args, **kwargs))6 unmodified linesdef vit_huge_patch16_224_mlpnorm(pretrained=False, **kwargs) -> VisionTransformer:""" ViT-Huge model (ViT-H/16) from original paper (https://arxiv.org/abs/2010.11929)."""model = vit_huge_patch16_224(pretrained=pretrained, **kwargs)for m in model.modules():if isinstance(m, Mlp) and not isinstance(m.norm, nn.LayerNorm):2 unmodified linesreturn model@register_modeldef vit_bigG_patch14_224(pretrained=False, **kwargs) -> VisionTransformer:model_args = dict(patch_size=14, embed_dim=1664, depth=48, num_heads=16, init_values=1e-6)model = _create_vision_transformer('vit_bigG_patch14', pretrained=False, **dict(model_args, **kwargs))return model19 unmodified linesif isinstance(mod.ls2, TIMMLayerScale):mod.ls2 = replace_ls(mod.ls2)pass23 unmodified lines242526272829302 unmodified lines333435363738393 unmodified lines434445464748492 unmodified lines525354555657586 unmodified lines656667686970712 unmodified lines74757677787980818283848586878889909119 unmodified lines11111211311423 unmodified linesdef vit_tiny_patch14_224(pretrained=False, **kwargs) -> VisionTransformer:""" ViT-Tiny (Vit-Ti/16)"""model_args = dict(patch_size=14, embed_dim=192, depth=12, num_heads=3, weight_init='skip')model = _create_vision_transformer('vit_tiny_patch14_224', pretrained=pretrained, **dict(model_args, **kwargs))return model2 unmodified linesdef vit_small_patch14_224(pretrained=False, **kwargs) -> VisionTransformer:""" ViT-Small (ViT-S/16)"""model_args = dict(patch_size=14, embed_dim=384, depth=12, num_heads=6, weight_init='skip')model = _create_vision_transformer('vit_small_patch16_224', pretrained=pretrained, **dict(model_args, **kwargs))return model3 unmodified lines""" ViT-Base (ViT-B/14) from original paper (https://arxiv.org/abs/2010.11929).ImageNet-1k weights fine-tuned from in21k @ 224x224, source https://github.com/google-research/vision_transformer."""model_args = dict(patch_size=14, embed_dim=768, depth=12, num_heads=12, weight_init='skip')model = _create_vision_transformer('vit_base_patch14_224', pretrained=pretrained, **dict(model_args, **kwargs))return model2 unmodified linesdef vit_huge_patch16_224(pretrained=False, **kwargs) -> VisionTransformer:""" ViT-Huge model (ViT-H/16) from original paper (https://arxiv.org/abs/2010.11929)."""model_args = dict(patch_size=16, embed_dim=1280, depth=32, num_heads=16, weight_init='skip')if pretrained:# There is no pretrained version of ViT-H/16, but we can adapt a ViT-H/14 for this purposemodel = _create_vision_transformer('vit_huge_patch14_224', pretrained=True, **dict(model_args, **kwargs))6 unmodified linesdef vit_huge_patch16_224_mlpnorm(pretrained=False, **kwargs) -> VisionTransformer:""" ViT-Huge model (ViT-H/16) from original paper (https://arxiv.org/abs/2010.11929)."""model = vit_huge_patch16_224(pretrained=pretrained, weight_init='skip', **kwargs)for m in model.modules():if isinstance(m, Mlp) and not isinstance(m.norm, nn.LayerNorm):2 unmodified linesreturn model@register_modeldef vit_giant_patch16_224(pretrained=False, **kwargs) -> VisionTransformer:""" ViT-giant model (ViT-g/16) from original paper (https://arxiv.org/abs/2010.11929)."""model_args = dict(patch_size=16, embed_dim=1536, depth=40, num_heads=24, weight_init='skip')model = _create_vision_transformer('vit_giant_patch16_224', pretrained=False, **dict(model_args, **kwargs))return model@register_modeldef vit_bigG_patch14_224(pretrained=False, **kwargs) -> VisionTransformer:model_args = dict(patch_size=14, embed_dim=1664, depth=48, num_heads=16, init_values=1e-6, weight_init='skip')model = _create_vision_transformer('vit_bigG_patch14', pretrained=False, **dict(model_args, **kwargs))return model19 unmodified linesif isinstance(mod.ls2, TIMMLayerScale):mod.ls2 = replace_ls(mod.ls2)pass
123version https://git-lfs.github.com/spec/v1oid sha256:fa6e741d60c99c87d8be4f74439daaadf1eb831bf78d4cfbe1e97ce672204bd1size 4638530048common.py+7
config.json+20-33
extra_timm_models.py+16-6
model.safetensorsAdded+3