def find_torch_hub_requirements(repo_or_dir, source="github"):
    """Locates the ``requirements.txt`` file on disk associated with a
    downloaded `PyTorch Hub <https://pytorch.org/hub>`_ model.

    Example usage::

        import fiftyone.utils.torch as fout

        req_path = fout.find_torch_hub_requirements("facebookresearch/dinov2")

        print(req_path)
        # '~/.cache/torch/hub/facebookresearch_dinov2_main/requirements.txt'

    Args:
        repo_or_dir: see :attr:`torch:torch.hub.load`
        source ("github"): see :attr:`torch:torch.hub.load`

    Returns:
        the path to the requirements file on disk
    """
    if source == "github":
        model_dir = torch.hub._get_cache_or_reload(
            repo_or_dir,
            False,
            True,
            "",
            verbose=False,
            skip_validation=True,
        )
    else:
        model_dir = repo_or_dir

    return os.path.join(model_dir, "requirements.txt")
Locates the ``requirements.txt`` file on disk associated with a
    downloaded `PyTorch Hub <https://pytorch.org/hub>`_ model.

    Example usage::

        import fiftyone.utils.torch as fout

        req_path = fout.find_torch_hub_requirements("facebookresearch/dinov2")

        print(req_path)
        # '~/.cache/torch/hub/facebookresearch_dinov2_main/requirements.txt'

    Args:
        repo_or_dir: see :attr:`torch:torch.hub.load`
        source ("github"): see :attr:`torch:torch.hub.load`

    Returns:
        the path to the requirements file on disk
    
fiftyone/utils/torch.py