fovi.hub

HuggingFace Hub integration for downloading pretrained fovi models.

This module provides utilities for downloading pretrained models from the HuggingFace Hub. Models are cached locally to avoid repeated downloads.

fovi.hub.download_model(model_name: str, cache_dir: str | None = None, revision: str | None = None, token: str | None = None) str[source]

Download a pretrained fovi model from HuggingFace Hub.

Downloads the model files to a local cache directory. If the model is already cached, returns the cached path without re-downloading.

Parameters:
  • model_name – Name of the model to download (e.g., ‘fovi-dinov3-splus_a-2.78_res-64_in1k’). Can be either just the model name or a full repo ID (e.g., ‘nblauch/fovi-dinov3-splus_a-2.78_res-64_in1k’).

  • cache_dir – Directory to cache downloaded models. Defaults to ~/.cache/fovi.

  • revision – Git revision (branch, tag, or commit) to download. Defaults to main.

  • token – HuggingFace token for private models. Uses cached token if not provided.

Returns:

Path to the downloaded model directory.

Raises:
  • huggingface_hub.utils.RepositoryNotFoundError – If the model doesn’t exist on HuggingFace Hub.

  • huggingface_hub.utils.RevisionNotFoundError – If the specified revision doesn’t exist.

Example

>>> from fovi.hub import download_model
>>> model_path = download_model('fovi-dinov3-splus_a-2.78_res-64_in1k')
>>> print(model_path)
/home/user/.cache/fovi/fovi-dinov3-splus_a-2.78_res-64_in1k