Skip to content

Commit

Permalink
fix: move torch import
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 629136419
  • Loading branch information
sasha-gitg authored and Copybara-Service committed Apr 29, 2024
1 parent d1fca81 commit e6d34df
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions vertexai/preview/developer/remote_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@
serializers,
)

try:
import torch
except ImportError:
pass

_LOGGER = base.Logger(__name__)

Expand Down Expand Up @@ -842,6 +838,8 @@ def my_train_method(self, ...):
Returns:
A custom model built on top of `torch.nn.Module` wrapped in DistributedDataParallel.
"""
import torch

if not model.cluster_spec: # cluster_spec is populated for multi-worker training
return model

Expand Down

0 comments on commit e6d34df

Please sign in to comment.