Skip to content

Improve benchmark command#244

Merged
drbh merged 6 commits intomainfrom
imporve-benchmark-command
Jan 29, 2026
Merged

Improve benchmark command#244
drbh merged 6 commits intomainfrom
imporve-benchmark-command

Conversation

@drbh
Copy link
Collaborator

@drbh drbh commented Jan 27, 2026

This pr includes two changes

  1. adds device to the Benchmark class so the benchmark runner can pass the detected device into the benchmark scripts. It also allows overriding this value within a benchmark script similar to seed
  2. adds tabulate as a optional dependency for benchmarks to avoid the hacky box drawing logic.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

danieldk
danieldk previously approved these changes Jan 29, 2026
Copy link
Member

@danieldk danieldk left a comment

Choose a reason for hiding this comment

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

Looks great!

Comment on lines 408 to 416
def get_device() -> str:
if TORCH_AVAILABLE:
if torch.cuda.is_available():
return "cuda"
elif hasattr(torch, "xpu") and torch.xpu.is_available():
return "xpu"
elif hasattr(torch.backends, "mps") and torch.backends.mps.is_available():
return "mps"
return "cpu"
Copy link
Member

Choose a reason for hiding this comment

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

I think we can reuse this function:

def backend() -> str:

But we can do that in a follow-up PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oh great point, just took a look and updated in this PR!

@drbh drbh merged commit 26355c5 into main Jan 29, 2026
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants