Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(train): start remote GPU training from instance without GPU #600

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion zetta_utils/convnet/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ def load_weights_file(
return model

with fsspec.open(ckpt_path) as f:
loaded_state_raw = torch.load(f)["state_dict"]
# Scheduler might not have GPU, but will still attempt to load model weights
map_location = "cpu" if not torch.cuda.is_available() else None
loaded_state_raw = torch.load(f, map_location=map_location)["state_dict"]
if component_names is None:
loaded_state = loaded_state_raw
elif remove_component_prefix:
Expand Down
2 changes: 1 addition & 1 deletion zetta_utils/training/lightning/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def _lightning_train_remote(
Creates a volume mount for `train.cue` in `/opt/zetta_utils/specs`.
Runs the command `zetta run specs/train.cue` on one or more worker pods.
"""
if train_args["trainer"]["accelerator"] == "gpu":
if train_args["trainer"]["accelerator"] in ("gpu", "cuda", "auto"):
num_devices = int(resource_limits["nvidia.com/gpu"]) # type: ignore
trainer_devices = train_args["trainer"]["devices"]
if (
Expand Down
Loading