Skip to content

Commit

Permalink
Minor fix for cuda cli option in FFCV examples
Browse files Browse the repository at this point in the history
  • Loading branch information
lrzpellegrini committed Oct 11, 2023
1 parent a09c096 commit 1ca45ad
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/ffcv/ffcv_enable.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

def main(cuda: int):
# --- CONFIG
device = torch.device(f"cuda:{cuda}" if torch.cuda.is_available() else "cpu")
device = torch.device(f"cuda:{cuda}" if cuda >= 0 and torch.cuda.is_available() else "cpu")
RNGManager.set_random_seeds(1234)

benchmark_type = "cifar100"
Expand Down
2 changes: 1 addition & 1 deletion examples/ffcv/ffcv_enable_rgb_compress.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@


def main(cuda: int):
device = torch.device(f"cuda:{cuda}" if torch.cuda.is_available() else "cpu")
device = torch.device(f"cuda:{cuda}" if cuda >= 0 and torch.cuda.is_available() else "cpu")
RNGManager.set_random_seeds(1234)

benchmark_type = "tinyimagenet"
Expand Down
2 changes: 1 addition & 1 deletion examples/ffcv/ffcv_try_speed.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

def main(cuda: int):
# --- CONFIG
device = torch.device(f"cuda:{cuda}" if torch.cuda.is_available() else "cpu")
device = torch.device(f"cuda:{cuda}" if cuda >= 0 and torch.cuda.is_available() else "cpu")
RNGManager.set_random_seeds(1234)

benchmark_type = "cifar100"
Expand Down

0 comments on commit 1ca45ad

Please sign in to comment.