From e5f0db2501dd8d496ea61cb5b0cba4db9c1062be Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Tue, 17 Dec 2024 16:36:49 -0800 Subject: [PATCH] Fix no-torch pipeline by not erroring out with cpu as new default accelerator --- .github/workflows/no-torch.yml | 1 + accelerator/cpu_accelerator.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/no-torch.yml b/.github/workflows/no-torch.yml index 1a13c0f3f4f1..5b89a6f36787 100644 --- a/.github/workflows/no-torch.yml +++ b/.github/workflows/no-torch.yml @@ -4,6 +4,7 @@ on: workflow_dispatch: pull_request: paths: + - 'accelerator/**' - '.github/workflows/no-torch.yml' - 'op_builder/**' schedule: diff --git a/accelerator/cpu_accelerator.py b/accelerator/cpu_accelerator.py index 0e49bd9f6458..572191ff9c13 100644 --- a/accelerator/cpu_accelerator.py +++ b/accelerator/cpu_accelerator.py @@ -3,9 +3,13 @@ # DeepSpeed Team -import torch from .abstract_accelerator import DeepSpeedAccelerator +try: + import torch +except ImportError as e: + pass + try: import oneccl_bindings_for_pytorch # noqa: F401 # type: ignore oneccl_imported_p = True