-
Notifications
You must be signed in to change notification settings - Fork 33.2k
91 lines (83 loc) · 2.93 KB
/
benchmark_v2.yml
File metadata and controls
91 lines (83 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
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