Skip to content

Commit 7e097bf

Browse files
authored
Merge branch 'main' into videollama3
2 parents ca5ef95 + 62ce6fc commit 7e097bf

1,336 files changed

Lines changed: 38581 additions & 203391 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: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
import argparse
1717
import copy
1818
import os
19-
import random
2019
from dataclasses import dataclass
21-
from typing import Any, Dict, List, Optional
22-
import glob
20+
from typing import Any, Optional
21+
2322
import yaml
2423

2524

@@ -82,15 +81,15 @@ def to_dict(self):
8281
@dataclass
8382
class CircleCIJob:
8483
name: str
85-
additional_env: Dict[str, Any] = None
86-
docker_image: List[Dict[str, str]] = None
87-
install_steps: List[str] = None
84+
additional_env: dict[str, Any] = None
85+
docker_image: list[dict[str, str]] = None
86+
install_steps: list[str] = None
8887
marker: Optional[str] = None
8988
parallelism: Optional[int] = 0
9089
pytest_num_workers: int = 8
91-
pytest_options: Dict[str, Any] = None
90+
pytest_options: dict[str, Any] = None
9291
resource_class: Optional[str] = "xlarge"
93-
tests_to_run: Optional[List[str]] = None
92+
tests_to_run: Optional[list[str]] = None
9493
num_test_files_per_worker: Optional[int] = 10
9594
# This should be only used for doctest job!
9695
command_timeout: Optional[int] = None
@@ -149,7 +148,7 @@ def to_dict(self):
149148
# Examples special case: we need to download NLTK files in advance to avoid cuncurrency issues
150149
timeout_cmd = f"timeout {self.command_timeout} " if self.command_timeout else ""
151150
marker_cmd = f"-m '{self.marker}'" if self.marker is not None else ""
152-
junit_flags = f" -p no:warning -o junit_family=xunit1 --junitxml=test-results/junit.xml"
151+
junit_flags = " -p no:warning -o junit_family=xunit1 --junitxml=test-results/junit.xml"
153152
joined_flaky_patterns = "|".join(FLAKY_TEST_FAILURE_PATTERNS)
154153
repeat_on_failure_flags = f"--reruns 5 --reruns-delay 2 --only-rerun '({joined_flaky_patterns})'"
155154
parallel = f' << pipeline.parameters.{self.job_name}_parallelism >> '
@@ -200,9 +199,9 @@ def to_dict(self):
200199
fi"""
201200
},
202201
},
203-
{"run": {"name": "Expand to show skipped tests", "when": "always", "command": f"python3 .circleci/parse_test_outputs.py --file tests_output.txt --skip"}},
204-
{"run": {"name": "Failed tests: show reasons", "when": "always", "command": f"python3 .circleci/parse_test_outputs.py --file tests_output.txt --fail"}},
205-
{"run": {"name": "Errors", "when": "always", "command": f"python3 .circleci/parse_test_outputs.py --file tests_output.txt --errors"}},
202+
{"run": {"name": "Expand to show skipped tests", "when": "always", "command": "python3 .circleci/parse_test_outputs.py --file tests_output.txt --skip"}},
203+
{"run": {"name": "Failed tests: show reasons", "when": "always", "command": "python3 .circleci/parse_test_outputs.py --file tests_output.txt --fail"}},
204+
{"run": {"name": "Errors", "when": "always", "command": "python3 .circleci/parse_test_outputs.py --file tests_output.txt --errors"}},
206205
{"store_test_results": {"path": "test-results"}},
207206
{"store_artifacts": {"path": "test-results/junit.xml"}},
208207
{"store_artifacts": {"path": "reports"}},

.circleci/parse_test_outputs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import re
21
import argparse
2+
import re
3+
34

45
def parse_pytest_output(file_path):
56
skipped_tests = {}

.github/scripts/assign_reviewers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
import os
17-
import github
1816
import json
19-
from github import Github
17+
import os
2018
import re
2119
from collections import Counter
2220
from pathlib import Path
2321

22+
import github
23+
from github import Github
24+
25+
2426
def pattern_to_regex(pattern):
2527
if pattern.startswith("/"):
2628
start_anchor = True

.github/workflows/benchmark_v2.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Benchmark v2 Framework
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
runner:
7+
description: 'GH Actions runner group to use'
8+
required: true
9+
type: string
10+
commit_sha:
11+
description: 'Commit SHA to benchmark'
12+
required: false
13+
type: string
14+
default: ''
15+
run_id:
16+
description: 'Custom run ID for organizing results (auto-generated if not provided)'
17+
required: false
18+
type: string
19+
default: ''
20+
benchmark_repo_id:
21+
description: 'HuggingFace Dataset to upload results to (e.g., "org/benchmark-results")'
22+
required: false
23+
type: string
24+
default: ''
25+
26+
env:
27+
HF_HOME: /mnt/cache
28+
TRANSFORMERS_IS_CI: yes
29+
# For gated repositories, we still need to agree to share information on the Hub repo. page in order to get access.
30+
# This token is created under the bot `hf-transformers-bot`.
31+
HF_HUB_READ_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }}
32+
33+
jobs:
34+
benchmark-v2:
35+
name: Benchmark v2
36+
runs-on: ${{ inputs.runner }}
37+
if: |
38+
(github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'run-benchmark')) ||
39+
(github.event_name == 'schedule')
40+
container:
41+
image: huggingface/transformers-pytorch-gpu
42+
options: --gpus all --privileged --ipc host --shm-size "16gb"
43+
steps:
44+
- name: Get repo
45+
uses: actions/checkout@v4
46+
with:
47+
ref: ${{ inputs.commit_sha || github.sha }}
48+
49+
- name: Install benchmark dependencies
50+
run: |
51+
python3 -m pip install -r benchmark_v2/requirements.txt
52+
53+
- name: Reinstall transformers in edit mode
54+
run: |
55+
python3 -m pip uninstall -y transformers
56+
python3 -m pip install -e ".[torch]"
57+
58+
- name: Show installed libraries and their versions
59+
run: |
60+
python3 -m pip list
61+
python3 -c "import torch; print(f'PyTorch version: {torch.__version__}')"
62+
python3 -c "import torch; print(f'CUDA available: {torch.cuda.is_available()}')"
63+
python3 -c "import torch; print(f'CUDA device count: {torch.cuda.device_count()}')" || true
64+
nvidia-smi || true
65+
66+
- name: Run benchmark v2
67+
working-directory: benchmark_v2
68+
run: |
69+
echo "Running benchmarks"
70+
python3 run_benchmarks.py \
71+
--commit-id '${{ inputs.commit_sha || github.sha }}' \
72+
--run-id '${{ inputs.run_id }}' \
73+
--push-to-hub '${{ inputs.benchmark_repo_id}}' \
74+
--token '${{ secrets.TRANSFORMERS_CI_RESULTS_UPLOAD_TOKEN }}' \
75+
--log-level INFO
76+
env:
77+
HF_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Benchmark v2 Scheduled Runner - A10 Single-GPU
2+
3+
on:
4+
schedule:
5+
# Run daily at 16:30 UTC
6+
- cron: "30 16 * * *"
7+
pull_request:
8+
types: [ opened, labeled, reopened, synchronize ]
9+
10+
jobs:
11+
benchmark-v2-default:
12+
name: Benchmark v2 - Default Models
13+
uses: ./.github/workflows/benchmark_v2.yml
14+
with:
15+
runner: aws-g5-4xlarge-cache-use1-public-80
16+
commit_sha: ${{ github.sha }}
17+
run_id: ${{ github.run_id }}
18+
benchmark_repo_id: hf-internal-testing/transformers-daily-benchmarks
19+
secrets: inherit
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Benchmark v2 Scheduled Runner - MI325 Single-GPU
2+
3+
on:
4+
schedule:
5+
# Run daily at 16:30 UTC
6+
- cron: "30 16 * * *"
7+
pull_request:
8+
types: [ opened, labeled, reopened, synchronize ]
9+
10+
jobs:
11+
benchmark-v2-default:
12+
name: Benchmark v2 - Default Models
13+
uses: ./.github/workflows/benchmark_v2.yml
14+
with:
15+
runner: amd-mi325-ci-1gpu
16+
commit_sha: ${{ github.sha }}
17+
run_id: ${{ github.run_id }}
18+
benchmark_repo_id: hf-internal-testing/transformers-daily-benchmarks
19+
secrets: inherit

.github/workflows/build_documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
commit_sha: ${{ github.sha }}
1717
package: transformers
1818
notebook_folder: transformers_doc
19-
languages: ar de en es fr hi it ko pt tr zh ja te
19+
languages: ar de en es fr hi it ja ko pt zh
2020
custom_container: huggingface/transformers-doc-builder
2121
secrets:
2222
token: ${{ secrets.HUGGINGFACE_PUSH }}

.github/workflows/model_jobs.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,28 +128,47 @@ jobs:
128128
echo "machine_type=$machine_type" >> $GITHUB_ENV
129129
echo "machine_type=$machine_type" >> $GITHUB_OUTPUT
130130
131+
- name: Create report directory if it doesn't exist
132+
shell: bash
133+
run: |
134+
mkdir -p /transformers/reports/${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ env.matrix_folders }}_test_reports
135+
echo "dummy" > /transformers/reports/${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ env.matrix_folders }}_test_reports/dummy.txt
136+
ls -la /transformers/reports/${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ env.matrix_folders }}_test_reports
137+
131138
- name: Run all tests on GPU
132139
working-directory: /transformers
133-
run: python3 -m pytest -rsfE -v --make-reports=${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ matrix.folders }}_test_reports tests/${{ matrix.folders }}
140+
run: |
141+
script -q -c "PATCH_TESTING_METHODS_TO_COLLECT_OUTPUTS=yes _PATCHED_TESTING_METHODS_OUTPUT_DIR=/transformers/reports/${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ env.matrix_folders }}_test_reports python3 -m pytest -rsfE -v --make-reports=${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ env.matrix_folders }}_test_reports tests/${{ matrix.folders }}" test_outputs.txt
142+
ls -la
143+
# Extract the exit code from the output file
144+
EXIT_CODE=$(tail -1 test_outputs.txt | grep -o 'COMMAND_EXIT_CODE="[0-9]*"' | cut -d'"' -f2)
145+
exit ${EXIT_CODE:-1}
134146
135147
- name: Failure short reports
136148
if: ${{ failure() }}
149+
# This step is only to show information on Github Actions log.
150+
# Always mark this step as successful, even if the report directory or the file `failures_short.txt` in it doesn't exist
137151
continue-on-error: true
138-
run: cat /transformers/reports/${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ matrix.folders }}_test_reports/failures_short.txt
152+
run: cat /transformers/reports/${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ env.matrix_folders }}_test_reports/failures_short.txt
139153

140-
- name: Run test
141-
shell: bash
154+
- name: Captured information
155+
if: ${{ failure() }}
156+
continue-on-error: true
157+
run: |
158+
cat /transformers/reports/${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ env.matrix_folders }}_test_reports/captured_info.txt
159+
160+
- name: Copy test_outputs.txt
161+
if: ${{ always() }}
162+
continue-on-error: true
142163
run: |
143-
mkdir -p /transformers/reports/${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ matrix.folders }}_test_reports
144-
echo "hello" > /transformers/reports/${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ matrix.folders }}_test_reports/hello.txt
145-
echo "${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ matrix.folders }}_test_reports"
164+
cp /transformers/test_outputs.txt /transformers/reports/${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ env.matrix_folders }}_test_reports
146165
147166
- name: "Test suite reports artifacts: ${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ env.matrix_folders }}_test_reports"
148167
if: ${{ always() }}
149168
uses: actions/upload-artifact@v4
150169
with:
151170
name: ${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ env.matrix_folders }}_test_reports
152-
path: /transformers/reports/${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ matrix.folders }}_test_reports
171+
path: /transformers/reports/${{ env.machine_type }}_${{ inputs.report_name_prefix }}_${{ env.matrix_folders }}_test_reports
153172

154173
collated_reports:
155174
name: Collated Reports

.github/workflows/pr_build_doc_with_comment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ permissions: {}
1414
jobs:
1515
get-pr-number:
1616
name: Get PR number
17-
if: ${{ github.event.issue.state == 'open' && contains(fromJSON('["ydshieh", "ArthurZucker", "zucchini-nlp", "qubvel", "molbap", "gante", "LysandreJik", "Cyrilvallez", "Rocketknight1", "SunMarc", "muellerzr", "eustlb", "MekkCyber", "manueldeprada", "vasqu", "ivarflakstad", "stevhliu", "ebezzam"]'), github.actor) && (startsWith(github.event.comment.body, 'build-doc')) }}
17+
if: ${{ github.event.issue.state == 'open' && contains(fromJSON('["ydshieh", "ArthurZucker", "zucchini-nlp", "molbap", "gante", "LysandreJik", "Cyrilvallez", "Rocketknight1", "SunMarc", "muellerzr", "eustlb", "MekkCyber", "manueldeprada", "vasqu", "ivarflakstad", "stevhliu", "ebezzam", "itazap"]'), github.actor) && (startsWith(github.event.comment.body, 'build-doc')) }}
1818
uses: ./.github/workflows/get-pr-number.yml
1919

2020
get-pr-info:

.github/workflows/self-comment-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
runs-on: ubuntu-22.04
3030
name: Get PR number
3131
# For security: only allow team members to run
32-
if: ${{ github.event.issue.state == 'open' && contains(fromJSON('["ydshieh", "ArthurZucker", "zucchini-nlp", "qubvel", "molbap", "gante", "LysandreJik", "Cyrilvallez", "Rocketknight1", "SunMarc", "muellerzr", "eustlb", "MekkCyber", "manueldeprada", "vasqu", "ivarflakstad", "stevhliu", "ebezzam", "remi-or"]'), github.actor) && (startsWith(github.event.comment.body, 'run-slow') || startsWith(github.event.comment.body, 'run slow') || startsWith(github.event.comment.body, 'run_slow')) }}
32+
if: ${{ github.event.issue.state == 'open' && contains(fromJSON('["ydshieh", "ArthurZucker", "zucchini-nlp", "molbap", "gante", "LysandreJik", "Cyrilvallez", "Rocketknight1", "SunMarc", "muellerzr", "eustlb", "MekkCyber", "manueldeprada", "vasqu", "ivarflakstad", "stevhliu", "ebezzam", "remi-or", "itazap"]'), github.actor) && (startsWith(github.event.comment.body, 'run-slow') || startsWith(github.event.comment.body, 'run slow') || startsWith(github.event.comment.body, 'run_slow')) }}
3333
outputs:
3434
PR_NUMBER: ${{ steps.set_pr_number.outputs.PR_NUMBER }}
3535
steps:

0 commit comments

Comments
 (0)