From 48a74133f68feb6da527c8e5d4214b93190e1591 Mon Sep 17 00:00:00 2001 From: Huy Do Date: Thu, 6 Nov 2025 23:03:48 -0800 Subject: [PATCH] [no ci] Make torch an optional dependency Signed-off-by: Huy Do --- .github/scripts/upload_benchmark_results.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/scripts/upload_benchmark_results.py b/.github/scripts/upload_benchmark_results.py index b8cf7c70..ec49d203 100755 --- a/.github/scripts/upload_benchmark_results.py +++ b/.github/scripts/upload_benchmark_results.py @@ -18,7 +18,14 @@ import boto3 import psutil -import torch + +try: + import torch + + torch_available = True +except ImportError: + torch_available = False + from git import Repo logging.basicConfig(level=logging.INFO) @@ -162,7 +169,7 @@ def get_benchmark_metadata( def get_runner_info(device_name: str, device_type: str) -> Dict[str, Any]: - if torch.cuda.is_available(): + if torch_available and torch.cuda.is_available(): if torch.version.hip: name = "rocm" elif torch.version.cuda: