e06fe8e8c6
Secret Leaks / trufflehog (push) Failing after 1s
Build documentation / build (push) Failing after 1s
Build documentation / build_other_lang (push) Failing after 0s
CodeQL Security Analysis / CodeQL Analysis (push) Failing after 0s
PR CI / pr-ci (push) Failing after 1s
Slow tests on important models (on Push - A10) / Get all modified files (push) Failing after 1s
Slow tests on important models (on Push - A10) / Model CI (push) Has been skipped
Self-hosted runner (benchmark) / Benchmark (aws-g5-4xlarge-cache) (push) Has been cancelled
New model PR merged notification / Notify new model (push) Has been cancelled
Update Transformers metadata / build_and_package (push) Has been cancelled
92 lines
2.9 KiB
YAML
92 lines
2.9 KiB
YAML
name: Benchmark v2 Framework
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
runner:
|
|
description: 'Runner to use for the benchmark job'
|
|
required: true
|
|
type: string
|
|
container_image:
|
|
description: 'Container image to use'
|
|
required: true
|
|
type: string
|
|
container_options:
|
|
description: 'Container options'
|
|
required: false
|
|
type: string
|
|
default: ''
|
|
commit_sha:
|
|
description: 'Commit SHA to benchmark'
|
|
required: false
|
|
type: string
|
|
run_id:
|
|
description: 'Run ID for tracking'
|
|
required: false
|
|
type: string
|
|
benchmark_repo_id:
|
|
description: 'Repository ID to push benchmark results'
|
|
required: true
|
|
type: string
|
|
|
|
env:
|
|
HF_HOME: /mnt/cache
|
|
TRANSFORMERS_IS_CI: yes
|
|
# For gated repositories, we still need to agree to share information on the Hub repo. page in order to get access.
|
|
# This token is created under the bot `hf-transformers-bot`.
|
|
HF_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }}
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
benchmark-v2:
|
|
name: Benchmark v2
|
|
runs-on: ${{ inputs.runner }}
|
|
if: |
|
|
(github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'run-benchmark')) ||
|
|
(github.event_name == 'schedule')
|
|
container:
|
|
image: ${{ inputs.container_image }}
|
|
options: ${{ inputs.container_options }}
|
|
steps:
|
|
- name: Get repo
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
ref: ${{ inputs.commit_sha || github.sha }}
|
|
persist-credentials: false
|
|
|
|
- name: Install benchmark dependencies
|
|
run: |
|
|
python3 -m pip install -r benchmark_v2/requirements.txt
|
|
|
|
- name: Reinstall transformers in edit mode
|
|
run: |
|
|
python3 -m pip uninstall -y transformers
|
|
python3 -m pip install -e ".[torch]"
|
|
|
|
- name: Show installed libraries and their versions
|
|
run: |
|
|
python3 -m pip list
|
|
python3 -c "import torch; print(f'PyTorch version: {torch.__version__}')"
|
|
python3 -c "import torch; print(f'CUDA available: {torch.cuda.is_available()}')"
|
|
python3 -c "import torch; print(f'CUDA device count: {torch.cuda.device_count()}')" || true
|
|
nvidia-smi || true
|
|
|
|
- name: Run benchmark v2
|
|
working-directory: benchmark_v2
|
|
env:
|
|
HF_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }}
|
|
COMMIT_ID: ${{ inputs.commit_sha || github.sha }}
|
|
RUN_ID: ${{ inputs.run_id }}
|
|
BENCHMARK_REPO_ID: ${{ inputs.benchmark_repo_id }}
|
|
UPLOAD_TOKEN: ${{ secrets.TRANSFORMERS_CI_RESULTS_UPLOAD_TOKEN }}
|
|
run: |
|
|
echo "Running benchmarks"
|
|
python3 run_benchmarks.py \
|
|
--commit-id "$COMMIT_ID" \
|
|
--run-id "$RUN_ID" \
|
|
--push-to-hub "$BENCHMARK_REPO_ID" \
|
|
--token "$UPLOAD_TOKEN" \
|
|
--log-level INFO
|