Skip to content
Open
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
8 changes: 5 additions & 3 deletions evals/action_anticipation_frozen/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,13 @@ def main(args_eval, resume_preempt=False):
except Exception:
pass

if not torch.cuda.is_available():
device = torch.device("cpu")
else:
if torch.cuda.is_available():
device = torch.device("cuda:0")
torch.cuda.set_device(device)
elif torch.backends.mps.is_available():
device = torch.device("mps")
else:
device = torch.device("cpu")

world_size, rank = init_distributed()
logger.info(f"Initialized (rank/world-size) {rank}/{world_size}")
Expand Down
8 changes: 5 additions & 3 deletions evals/image_classification_frozen/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,13 @@ def main(args_eval, resume_preempt=False):
except Exception:
pass

if not torch.cuda.is_available():
device = torch.device("cpu")
else:
if torch.cuda.is_available():
device = torch.device("cuda:0")
torch.cuda.set_device(device)
elif torch.backends.mps.is_available():
device = torch.device("mps")
else:
device = torch.device("cpu")

world_size, rank = init_distributed()
logger.info(f"Initialized (rank/world-size) {rank}/{world_size}")
Expand Down
6 changes: 5 additions & 1 deletion evals/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ def process_main(args, rank, fname, world_size, devices):
)
# Single-GPU debugging
else:
process_main(args=args, rank=0, fname=args.fname, world_size=1, devices=["cuda:0"])
if torch.backends.mps.is_available():
device = "mps"
else:
device = "cuda:0"
Comment on lines +107 to +110
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default should be cuda here, not "mps".

process_main(args=args, rank=0, fname=args.fname, world_size=1, devices=[device])
else:
num_gpus = len(args.devices)
mp.set_start_method("spawn")
Expand Down
8 changes: 5 additions & 3 deletions evals/video_classification_frozen/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,13 @@ def main(args_eval, resume_preempt=False):
except Exception:
pass

if not torch.cuda.is_available():
device = torch.device("cpu")
else:
if torch.cuda.is_available():
device = torch.device("cuda:0")
torch.cuda.set_device(device)
elif torch.backends.mps.is_available():
device = torch.device("mps")
else:
device = torch.device("cpu")

world_size, rank = init_distributed()
logger.info(f"Initialized (rank/world-size) {rank}/{world_size}")
Expand Down
Loading