Skip to content

Commit

Permalink
taking care if cuda fails
Browse files Browse the repository at this point in the history
  • Loading branch information
manila95 committed Sep 18, 2023
1 parent 2f6a2b3 commit b7e9ca3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cleanrl/ppo_continuous_action_wandb.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def train(cfg):
torch.manual_seed(cfg.model_seed)
torch.backends.cudnn.deterministic = cfg.torch_deterministic

device = torch.device("cuda" if torch.cuda.is_available() and cfg.cuda else "cpu")
device = torch.device("cuda" if torch.cuda.is_available() and torch.cuda.device_count() > 0 and cfg.cuda else "cpu")

# env setup
envs = gym.vector.SyncVectorEnv(
Expand Down

0 comments on commit b7e9ca3

Please sign in to comment.