Run this model with HF Jobs
Run nvidia/RADIO 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/RADIO. 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/RADIO 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/RADIO with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nvidia/RADIO with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-feature-extraction", model="nvidia/RADIO", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("nvidia/RADIO", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Fix double conditioning
#6
by mranzinger - opened
Files changed (3)
- config.json+1
- hf_model.py+4-1
- radio_model.py+8-1
346 unmodified lines347348349350351352353346 unmodified lines "AutoConfig": "hf_model.RADIOConfig", "AutoModel": "hf_model.RADIOModel" }, "external_conditioner": false, "max_resolution": 2048, "patch_size": 16, "preferred_resolution": [44 unmodified lines4546474849505112 unmodified lines646566676869706 unmodified lines777879788081828333 unmodified lines11711811912012112212344 unmodified lines preferred_resolution: Optional[Resolution] = None, adaptor_names: Union[str, List[str]] = None, vitdet_window_size: Optional[int] = None, external_conditioner: Optional[bool] = False, **kwargs, ): self.args = args12 unmodified lines ) self.adaptor_names = adaptor_names self.vitdet_window_size = vitdet_window_size self.external_conditioner = external_conditioner super().__init__(**kwargs)
6 unmodified lines
config_class = RADIOConfig
def __init__(self, config): def __init__(self, config: RADIOConfig): super().__init__(config)
RADIOArgs = namedtuple("RADIOArgs", config.args.keys())33 unmodified lines preferred_resolution=config.preferred_resolution, adaptors=adaptors, ) self.radio_model._external_conditioner = config.external_conditioner
@property def adaptors(self) -> nn.ModuleDict:50 unmodified lines51525354555657585960616256 unmodified lines11912012112211612312412512650 unmodified lines self._patch_size = patch_size self._max_resolution = max_resolution self._window_size = window_size # This is a hack workaround for huggingface, since their # data prep is annoying and complicated. If set to true, # then will not call `self.input_conditioner` on the # input tensor. This will be set in `hf_model.RADIOModel` # where appropriate. self._external_conditioner = False
adaptors = adaptors or dict() self.adaptors = nn.ModuleDict(adaptors)56 unmodified lines '`self.get_nearest_supported_resolution(<height>, <width>) is provided as a convenience API. ' f'Input: {x.shape[-2:]}, Nearest: {self.get_nearest_supported_resolution(*x.shape[-2:])}')
if not self._external_conditioner: x = self.input_conditioner(x) x = self.input_conditioner(x) y = self.model.forward_features(x)
if isinstance(self.model, VisionTransformer):config.json+1
hf_model.py+4-1
radio_model.py+8-1