src/transformers/utils/import_utils.py/is_torch_cuda_available
def is_torch_cuda_available():
    if is_torch_available():
        import torch

        return torch.cuda.is_available()
    else:
        return False