def load_torch_hub_image_model(repo_or_dir, model, hub_kwargs=None, **kwargs):
    """Loads an image model from `PyTorch Hub <https://pytorch.org/hub>`_ as a
    :class:`TorchImageModel`.

    Example usage::

        import fiftyone.utils.torch as fout

        model = fout.load_torch_hub_image_model(
            "facebookresearch/dinov2",
            "dinov2_vits14",
            image_patch_size=14,
            embeddings_layer="head",
        )

        assert model.has_embeddings is True

    Args:
        repo_or_dir: see :attr:`torch:torch.hub.load`
        model: see :attr:`torch:torch.hub.load`
        **kwargs: additional parameters for :class:`TorchImageModelConfig`

    Returns:
        a :class:`TorchImageModel`
    """
    e = {"repo_or_dir": repo_or_dir, "model": model}
    if hub_kwargs:
        e.update(**hub_kwargs)

    d = {
        "entrypoint_fcn": load_torch_hub_raw_model,
        "entrypoint_args": e,
    }
    d.update(**kwargs)

    config = TorchImageModelConfig(d)
    return TorchImageModel(config)
Loads an image model from `PyTorch Hub <https://pytorch.org/hub>`_ as a
    :class:`TorchImageModel`.

    Example usage::

        import fiftyone.utils.torch as fout

        model = fout.load_torch_hub_image_model(
            "facebookresearch/dinov2",
            "dinov2_vits14",
            image_patch_size=14,
            embeddings_layer="head",
        )

        assert model.has_embeddings is True

    Args:
        repo_or_dir: see :attr:`torch:torch.hub.load`
        model: see :attr:`torch:torch.hub.load`
        **kwargs: additional parameters for :class:`TorchImageModelConfig`

    Returns:
        a :class:`TorchImageModel`
    
fiftyone/utils/torch.py