Skip to content

Commit 0f708d5

Browse files
loadamsamaurya
authored andcommitted
Fix torch include in op_builder/mlu/fused_adam.py and update no-torch workflow triggers (deepspeedai#6584)
Changes from deepspeedai#6472 caused the no-torch workflow that is an example of how we build the DeepSpeed release package to fail (so we caught this before a release, see more in deepspeedai#6402). These changes also copy the style used to include torch in other accelerator op_builder implementations, such as npu [here](https://github.com/microsoft/DeepSpeed/blob/master/op_builder/npu/fused_adam.py#L8) and hpu [here](https://github.com/microsoft/DeepSpeed/blob/828ddfbbda2482412fffc89f5fcd3b0d0eba9a62/op_builder/hpu/fused_adam.py#L15). This also updates the no-torch workflow to run on all changes to the op_builder directory. The test runs quickly and shouldn't add any additional testing burden there. Resolves: deepspeedai#6576
1 parent 7c32af4 commit 0f708d5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.github/workflows/no-torch.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
pull_request:
66
paths:
77
- '.github/workflows/no-torch.yml'
8+
- 'op_builder/**'
89
schedule:
910
- cron: "0 0 * * *"
1011

op_builder/mlu/fused_adam.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
# DeepSpeed Team
66

77
from .builder import MLUOpBuilder
8-
import torch
8+
9+
try:
10+
import torch
11+
except ImportError as e:
12+
pass
913

1014

1115
class MLUFusedAdam:

0 commit comments

Comments
 (0)