Skip to content

Commit e6d34df

Browse files
sasha-gitgcopybara-github
authored andcommitted
fix: move torch import
PiperOrigin-RevId: 629136419
1 parent d1fca81 commit e6d34df

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

vertexai/preview/developer/remote_specs.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@
3434
serializers,
3535
)
3636

37-
try:
38-
import torch
39-
except ImportError:
40-
pass
4137

4238
_LOGGER = base.Logger(__name__)
4339

@@ -842,6 +838,8 @@ def my_train_method(self, ...):
842838
Returns:
843839
A custom model built on top of `torch.nn.Module` wrapped in DistributedDataParallel.
844840
"""
841+
import torch
842+
845843
if not model.cluster_spec: # cluster_spec is populated for multi-worker training
846844
return model
847845

0 commit comments

Comments
 (0)