Skip to content

Commit 515fe45

Browse files
authored
Merge branch 'main' into videollama3
2 parents 28c21de + 21f0903 commit 515fe45

303 files changed

Lines changed: 5782 additions & 25501 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/create_circleci_config.py

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ def to_dict(self):
177177
"command": f"TESTS=$(circleci tests split --split-by=timings {self.job_name}_test_list.txt) && echo $TESTS > splitted_tests.txt && echo $TESTS | tr ' ' '\n'" if self.parallelism else f"awk '{{printf \"%s \", $0}}' {self.job_name}_test_list.txt > splitted_tests.txt"
178178
}
179179
},
180-
{"run": {"name": "fetch hub objects before pytest", "command": "python3 utils/fetch_hub_objects_for_ci.py"}},
180+
# During the CircleCI docker images build time, we might already (or not) download the data.
181+
# If it's done already, the files are inside the directory `/test_data/`.
182+
{"run": {"name": "fetch hub objects before pytest", "command": "cp -r /test_data/* . 2>/dev/null || true; python3 utils/fetch_hub_objects_for_ci.py"}},
181183
{"run": {
182184
"name": "Run tests",
183185
"command": f"({timeout_cmd} python3 -m pytest {marker_cmd} -n {self.pytest_num_workers} {junit_flags} {repeat_on_failure_flags} {' '.join(pytest_flags)} $(cat splitted_tests.txt) | tee tests_output.txt)"}
@@ -262,7 +264,6 @@ def job_name(self):
262264
docker_image=[{"image": "huggingface/transformers-custom-tokenizers"}],
263265
)
264266

265-
266267
examples_torch_job = CircleCIJob(
267268
"examples_torch",
268269
additional_env={"OMP_NUM_THREADS": 8},
@@ -286,35 +287,20 @@ def job_name(self):
286287
resource_class="medium",
287288
)
288289

289-
290-
onnx_job = CircleCIJob(
291-
"onnx",
292-
docker_image=[{"image":"huggingface/transformers-torch-tf-light"}],
293-
install_steps=[
294-
"uv pip install .[testing,sentencepiece,onnxruntime,vision,rjieba]",
295-
],
296-
pytest_options={"k onnx": None},
297-
pytest_num_workers=1,
298-
resource_class="small",
299-
)
300-
301-
302290
exotic_models_job = CircleCIJob(
303291
"exotic_models",
304292
docker_image=[{"image":"huggingface/transformers-exotic-models"}],
305293
parallelism=4,
306294
pytest_options={"durations": 100},
307295
)
308296

309-
310297
repo_utils_job = CircleCIJob(
311298
"repo_utils",
312299
docker_image=[{"image":"huggingface/transformers-consistency"}],
313300
pytest_num_workers=4,
314301
resource_class="large",
315302
)
316303

317-
318304
non_model_job = CircleCIJob(
319305
"non_model",
320306
docker_image=[{"image": "huggingface/transformers-torch-light"}],
@@ -350,7 +336,7 @@ def job_name(self):
350336
pytest_num_workers=1,
351337
)
352338

353-
REGULAR_TESTS = [torch_job, hub_job, onnx_job, tokenization_job, processor_job, generate_job, non_model_job] # fmt: skip
339+
REGULAR_TESTS = [torch_job, hub_job, tokenization_job, processor_job, generate_job, non_model_job] # fmt: skip
354340
EXAMPLES_TESTS = [examples_torch_job]
355341
PIPELINE_TESTS = [pipelines_torch_job]
356342
REPO_UTIL_TESTS = [repo_utils_job]

.github/workflows/build-ci-docker-images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
strategy:
2828
matrix:
29-
file: ["quality", "consistency", "custom-tokenizers", "torch-light", "tf-light", "exotic-models", "torch-tf-light", "jax-light", "examples-torch", "examples-tf"]
29+
file: ["quality", "consistency", "custom-tokenizers", "torch-light", "exotic-models", "examples-torch"]
3030
continue-on-error: true
3131

3232
steps:

.github/workflows/build-nightly-ci-docker-images.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: Build docker images (Nightly CI)
22

33
on:
44
workflow_call:
5+
inputs:
6+
job:
7+
required: true
8+
type: string
59
push:
610
branches:
711
- build_nightly_ci_docker_image*
@@ -12,7 +16,8 @@ concurrency:
1216

1317
jobs:
1418
latest-with-torch-nightly-docker:
15-
name: "Nightly PyTorch + Stable TensorFlow"
19+
name: "Nightly PyTorch"
20+
if: inputs.job == 'latest-with-torch-nightly-docker' || inputs.job == ''
1621
runs-on:
1722
group: aws-general-8-plus
1823
steps:
@@ -41,6 +46,7 @@ jobs:
4146

4247
nightly-torch-deepspeed-docker:
4348
name: "Nightly PyTorch + DeepSpeed"
49+
if: inputs.job == 'nightly-torch-deepspeed-docker' || inputs.job == ''
4450
runs-on:
4551
group: aws-g4dn-2xlarge-cache
4652
steps:

.github/workflows/model_jobs.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ on:
2525
required: false
2626
default: run_models_gpu
2727
type: string
28+
runner_type:
29+
required: false
30+
type: string
31+
report_repo_id:
32+
required: false
33+
type: string
2834

2935
env:
3036
HF_HOME: /mnt/cache
@@ -143,3 +149,15 @@ jobs:
143149
with:
144150
name: ${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ env.matrix_folders }}_test_reports
145151
path: /transformers/reports/${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ matrix.folders }}_test_reports
152+
153+
collated_reports:
154+
name: Collated Reports
155+
if: ${{ always() }}
156+
needs: run_models_gpu
157+
uses: huggingface/transformers/.github/workflows/collated-reports.yml@main
158+
with:
159+
job: run_models_gpu
160+
report_repo_id: ${{ inputs.report_repo_id }}
161+
gpu_name: ${{ inputs.runner_type }}
162+
machine_type: ${{ inputs.machine_type }}
163+
secrets: inherit

.github/workflows/self-nightly-caller.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
build_nightly_torch_ci_images:
2323
name: Build CI Docker Images with nightly torch
2424
uses: ./.github/workflows/build-nightly-ci-docker-images.yml
25+
with:
26+
job: latest-with-torch-nightly-docker
2527
secrets: inherit
2628

2729
setup:

.github/workflows/self-scheduled-amd-mi355-caller.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
job: run_models_gpu
2222
slack_report_channel: "#amd-hf-ci"
2323
runner_scale_set: amd-mi355-ci
24-
docker: huggingface/transformers-pytorch-amd-gpu
24+
docker: huggingface/testing-rocm7.0-preview
2525
ci_event: Scheduled CI (AMD) - mi355
2626
report_repo_id: optimum-amd/transformers_daily_ci
2727
secrets: inherit
@@ -33,7 +33,7 @@ jobs:
3333
job: run_pipelines_torch_gpu
3434
slack_report_channel: "#amd-hf-ci"
3535
runner_scale_set: amd-mi355-ci
36-
docker: huggingface/transformers-pytorch-amd-gpu
36+
docker: huggingface/testing-rocm7.0-preview
3737
ci_event: Scheduled CI (AMD) - mi355
3838
report_repo_id: optimum-amd/transformers_daily_ci
3939
secrets: inherit
@@ -45,7 +45,7 @@ jobs:
4545
job: run_examples_gpu
4646
slack_report_channel: "#amd-hf-ci"
4747
runner_scale_set: amd-mi355-ci
48-
docker: huggingface/transformers-pytorch-amd-gpu
48+
docker: huggingface/testing-rocm7.0-preview
4949
ci_event: Scheduled CI (AMD) - mi355
5050
report_repo_id: optimum-amd/transformers_daily_ci
5151
secrets: inherit
@@ -57,7 +57,7 @@ jobs:
5757
job: run_torch_cuda_extensions_gpu
5858
slack_report_channel: "#amd-hf-ci"
5959
runner_scale_set: amd-mi355-ci
60-
docker: huggingface/transformers-pytorch-deepspeed-amd-gpu
60+
docker: huggingface/testing-rocm7.0-preview
6161
ci_event: Scheduled CI (AMD) - mi355
6262
report_repo_id: optimum-amd/transformers_daily_ci
6363
secrets: inherit

.github/workflows/self-scheduled-caller.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
slack_report_channel: "#transformers-ci-daily-models"
5353
docker: huggingface/transformers-all-latest-gpu
5454
ci_event: Daily CI
55+
runner_type: "a10"
5556
report_repo_id: hf-internal-testing/transformers_daily_ci
5657
commit_sha: ${{ github.sha }}
5758
secrets: inherit

.github/workflows/self-scheduled.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ on:
3131
commit_sha:
3232
required: false
3333
type: string
34+
runner_type:
35+
required: false
36+
type: string
3437
models:
3538
default: ""
3639
required: false
@@ -126,6 +129,8 @@ jobs:
126129
runner_map: ${{ needs.setup.outputs.runner_map }}
127130
docker: ${{ inputs.docker }}
128131
commit_sha: ${{ inputs.commit_sha || github.sha }}
132+
runner_type: ${{ inputs.runner_type }}
133+
report_repo_id: ${{ inputs.report_repo_id }}
129134
secrets: inherit
130135

131136
run_trainer_and_fsdp_gpu:

benchmark_v2/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
benchmark_results/

benchmark_v2/README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Benchmarking v2
2+
3+
A comprehensive benchmarking framework for transformer models that supports multiple execution modes (eager, compiled, kernelized), detailed performance metrics collection, and structured output format.
4+
5+
6+
## Quick Start
7+
8+
### Running All Benchmarks
9+
10+
```bash
11+
# Run all benchmarks with default settings
12+
python run_benchmarks.py
13+
14+
# Specify output directory
15+
python run_benchmarks.py --output-dir my_results
16+
17+
# Run with custom parameters
18+
python run_benchmarks.py \
19+
--warmup-iterations 5 \
20+
--measurement-iterations 10 \
21+
--num-tokens-to-generate 200
22+
```
23+
24+
### Running Specific Benchmarks
25+
26+
```bash
27+
# Include only specific benchmarks
28+
python run_benchmarks.py --include llama
29+
30+
# Exclude specific benchmarks
31+
python run_benchmarks.py --exclude old_benchmark
32+
33+
## Output Format
34+
35+
Results are saved as JSON files with the following structure:
36+
37+
```json
38+
{
39+
"model_name": "llama_2_7b",
40+
"benchmark_scenarios": [
41+
{
42+
"scenario_name": "eager_variant",
43+
"metadata": {
44+
"timestamp": "2025-01-XX...",
45+
"commit_id": "abc123...",
46+
"hardware_info": {
47+
"gpu_name": "NVIDIA A100",
48+
"gpu_memory_total": 40960,
49+
"cpu_count": 64
50+
},
51+
"config": {
52+
"variant": "eager",
53+
"warmup_iterations": 3,
54+
"measurement_iterations": 5
55+
}
56+
},
57+
"measurements": {
58+
"latency": {
59+
"mean": 2.45,
60+
"median": 2.43,
61+
"std": 0.12,
62+
"min": 2.31,
63+
"max": 2.67,
64+
"p95": 2.61,
65+
"p99": 2.65
66+
},
67+
"time_to_first_token": {
68+
"mean": 0.15,
69+
"std": 0.02
70+
},
71+
"tokens_per_second": {
72+
"mean": 87.3,
73+
"unit": "tokens/sec"
74+
}
75+
},
76+
"gpu_metrics": {
77+
"gpu_utilization_mean": 85.2,
78+
"gpu_memory_used_mean": 12450
79+
}
80+
}
81+
]
82+
}
83+
```
84+
85+
### Debug Mode
86+
87+
```bash
88+
python run_benchmarks.py --log-level DEBUG
89+
```
90+
91+
## Contributing
92+
93+
To add new benchmarks:
94+
95+
1. Create a new file in `benches/`
96+
2. Implement the `ModelBenchmark` interface
97+
3. Add a runner function (`run_<benchmark_name>` or `run_benchmark`)
98+
4. run_benchmarks.py

0 commit comments

Comments
 (0)