Hub#

Utilities for downloading models from HuggingFace Hub.

Models are cached locally after first download (~500MB each).

download_model#

download_model #

download_model(name: str) -> Tuple[Path, Path]

Download model config and weights from HuggingFace.

Files are cached locally after first download.

Parameters:

Name Type Description Default
name str

Model name (e.g., 'outdoor-resnet101')

required

Returns:

Type Description
Tuple[Path, Path]

Tuple of (config_path, weights_path)

Raises:

Type Description
ValueError

If model name is not recognized

Source code in src/panodac/hub.py
def download_model(name: str) -> Tuple[Path, Path]:
    """Download model config and weights from HuggingFace.

    Files are cached locally after first download.

    Args:
        name: Model name (e.g., 'outdoor-resnet101')

    Returns:
        Tuple of (config_path, weights_path)

    Raises:
        ValueError: If model name is not recognized
    """
    if name not in MODELS:
        raise ValueError(f"Unknown model '{name}'. Available: {list(MODELS.keys())}")

    model_info = MODELS[name]

    config_path = hf_hub_download(
        repo_id=HF_REPO,
        filename=model_info["config"],
    )

    weights_path = hf_hub_download(
        repo_id=HF_REPO,
        filename=model_info["weights"],
    )

    return Path(config_path), Path(weights_path)

load_config#

load_config #

load_config(config_path: Path) -> dict

Load model configuration from JSON file.

Parameters:

Name Type Description Default
config_path Path

Path to config JSON file

required

Returns:

Type Description
dict

Configuration dictionary

Source code in src/panodac/hub.py
def load_config(config_path: Path) -> dict:
    """Load model configuration from JSON file.

    Args:
        config_path: Path to config JSON file

    Returns:
        Configuration dictionary
    """
    with open(config_path, "r") as f:
        return json.load(f)

Available Models#

Models are hosted at huggingface.co/yuliangguo/depth-any-camera.

Model Config File Weights File
outdoor-resnet101 dac_resnet101_outdoor.json dac_resnet101_outdoor.pt
outdoor-swinl dac_swinl_outdoor.json dac_swinl_outdoor.pt
indoor-resnet101 dac_resnet101_indoor.json dac_resnet101_indoor.pt
indoor-swinl dac_swinl_indoor.json dac_swinl_indoor.pt