Benchmark CUDA PyTorch #113
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Benchmark CUDA PyTorch | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 3 * * 0" | |
pull_request: | |
concurrency: | |
cancel-in-progress: true | |
group: ${{ github.workflow }}-${{ github.ref }} | |
env: | |
IMAGE: ghcr.io/huggingface/optimum-benchmark:latest-cuda | |
jobs: | |
run_benchmarks: | |
if: >- | |
(github.event_name == 'push' && contains(github.event.head_commit.message, 'cuda_pytorch')) || | |
(github.event_name == 'push' && contains(github.event.head_commit.message, 'all_benchmarks')) || | |
(github.event_name == 'push' && github.ref == 'refs/heads/main') || | |
github.event_name == 'workflow_dispatch' || | |
(github.event_name == 'pull_request' && ( | |
contains(github.event.pull_request.labels.*.name, 'leaderboard') || | |
contains(github.event.pull_request.labels.*.name, 'cuda') || | |
contains(github.event.pull_request.labels.*.name, 'pytorch') || | |
contains(github.event.pull_request.labels.*.name, 'cuda_pytorch') | |
)) | |
strategy: | |
fail-fast: false | |
matrix: | |
subset: [torchao] | |
machine: | |
[ | |
{ name: 1xA10, runs-on: { group: "aws-g5-4xlarge-plus" } }, | |
{ name: 1xT4, runs-on: { group: "aws-g4dn-2xlarge" } }, | |
] | |
runs-on: ${{ matrix.machine.runs-on }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run benchmarks | |
uses: addnab/docker-run-action@v3 | |
env: | |
SUBSET: ${{ matrix.subset }} | |
MACHINE: ${{ matrix.machine.name }} | |
HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
BENCHMARK_TOP_N: 50 | |
with: | |
image: ${{ env.IMAGE }} | |
options: | | |
--rm | |
--gpus all | |
--shm-size 64G | |
--env SUBSET | |
--env MACHINE | |
--env HF_TOKEN | |
--env MKL_THREADING_LAYER=GNU | |
--env HF_HUB_ENABLE_HF_TRANSFER=1 | |
--env BENCHMARK_TOP_N | |
--volume ${{ github.workspace }}:/workspace | |
--workdir /workspace | |
run: | | |
pip install -e .[cuda] | |
llm-perf run-benchmark --hardware cuda --backend pytorch |