Skip to content

Benchmark CPU PyTorch #109

Benchmark CPU PyTorch

Benchmark CPU PyTorch #109

name: Benchmark CPU PyTorch
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
pull_request:
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
env:
IMAGE: ghcr.io/huggingface/optimum-benchmark:latest-cpu
jobs:
run_benchmarks:
if: >-
(github.event_name == 'push' && contains(github.event.head_commit.message, 'cpu_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, 'cpu') ||
contains(github.event.pull_request.labels.*.name, 'pytorch') ||
contains(github.event.pull_request.labels.*.name, 'cpu_pytorch')
))
strategy:
fail-fast: false
matrix:
subset: [unquantized]
machine:
[{ name: 32vCPU-C7i, runs-on: { group: "aws-c7i-8xlarge-plus" } }]
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
--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 .
llm-perf run-benchmark --hardware cpu --backend pytorch