def torchvision_vit_available() -> bool:
    """Checks if Vision Transformer (ViT) models are available in torchvision.

    This function checks if the `vision_transformer` module is available in torchvision,
    which requires torchvision version >= 0.12. It also handles exceptions related to
    CUDA version mismatches and installation issues.

    Returns:
        True if the Vision Transformer (ViT) models are available in torchvision,
        otherwise False.
    """
    try:
        import torchvision.models.vision_transformer  # Requires torchvision >=0.12.
    except (
        RuntimeError,  # Different CUDA versions for torch and torchvision.
        OSError,  # Different CUDA versions for torch and torchvision (old).
        ImportError,  # No installation or old version of torchvision.
    ):
        return False
    return True
Checks if Vision Transformer (ViT) models are available in torchvision.

    This function checks if the `vision_transformer` module is available in torchvision,
    which requires torchvision version >= 0.12. It also handles exceptions related to
    CUDA version mismatches and installation issues.

    Returns:
        True if the Vision Transformer (ViT) models are available in torchvision,
        otherwise False.
    
lightly/utils/dependency.py