Skip to content

Commit

Permalink
Make readme benchmarks robust to CUDA not being present (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
scotts authored Nov 21, 2024
1 parent 7e2da5d commit 08236be
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions benchmarks/decoders/generate_readme_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def main() -> None:

decoder_dict = {}
decoder_dict["torchcodec"] = TorchCodecPublic()
decoder_dict["torchcodec[cuda]"] = TorchCodecPublic(device="cuda")
if torch.cuda.is_available():
decoder_dict["torchcodec[cuda]"] = TorchCodecPublic(device="cuda")
decoder_dict["torchvision[video_reader]"] = TorchVision("video_reader")
decoder_dict["torchaudio"] = TorchAudioDecoder()

Expand All @@ -80,7 +81,7 @@ def main() -> None:
batch_parameters=BatchParameters(batch_size=50, num_threads=10),
resize_height=256,
resize_width=256,
resize_device="cuda",
resize_device="cuda" if torch.cuda.is_available() else "cpu",
),
)
data_for_writing = {
Expand Down

0 comments on commit 08236be

Please sign in to comment.