Skip to content

Commit 56d1bda

Browse files
JKSenthilfacebook-github-bot
authored andcommitted
make torch compile callback OSS compatible
Summary: Touches few torch.compile calls in TorchTNT which rely on nightlies to be OSS friendly Reviewed By: galrotem Differential Revision: D56483268 fbshipit-source-id: d6d277e2e7eda895ca93047558b10e554effc96a
1 parent c5b9adb commit 56d1bda

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

torchtnt/framework/callbacks/torch_compile.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,17 @@
88

99
import logging
1010

11-
from torch._inductor.codecache import shutdown_compile_workers
11+
try:
12+
from torch._inductor.codecache import shutdown_compile_workers
13+
except ImportError:
14+
15+
def shutdown_compile_workers() -> None:
16+
logging.warning(
17+
"shutdown_compile_workers is not available in your version of PyTorch. \
18+
Please use nightly version to enable this feature."
19+
)
20+
21+
1222
from torchtnt.framework.callback import Callback
1323
from torchtnt.framework.state import State
1424
from torchtnt.framework.unit import TTrainUnit

0 commit comments

Comments
 (0)