fovi.arch.dinov3

fovi.arch.dinov3.load_dinov3(path, device='cuda', pretrained=True)[source]

Load a DinoV3 model and processor from Hugging Face.

Requires HF_TOKEN environment variable to be set for gated models.

Parameters:
  • path (str) – Path or model identifier for the DinoV3 model.

  • device (str, optional) – Device to load the model on. Defaults to ‘cuda’.

Returns:

A tuple containing (model, processor).

Return type:

tuple

fovi.arch.dinov3.build_fovi_dinov3(cfg, device='cuda')[source]

Build a foveated DinoV3 model from configuration.

Parameters:
  • cfg – Configuration object containing model and training parameters.

  • device (str, optional) – Device to build the model on. Defaults to ‘cuda’.

Returns:

The configured DinoV3 model.

Return type:

torch.nn.Module

fovi.arch.dinov3.prep_fovi_dinov3_finetuning(model, cfg, device='cuda', key='pretrained_model')[source]

Prepare a DinoV3 model for fine-tuning based on configuration.

Parameters:
  • model – The DinoV3 model to prepare.

  • cfg – Configuration object containing fine-tuning parameters.

  • device (str, optional) – Device to prepare the model on. Defaults to ‘cuda’.

  • key (str) – which key of the config to look for finetuning strategies

Returns:

The prepared model with appropriate parameters frozen/unfrozen.

Return type:

torch.nn.Module