Skip to content

Commit fbabd29

Browse files
authored
Merge branch 'huggingface:main' into videollama3
2 parents 80481be + 58e13b9 commit fbabd29

445 files changed

Lines changed: 6911 additions & 2354 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.

.github/workflows/model_jobs.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ on:
1212
slice_id:
1313
required: true
1414
type: number
15-
runner_map:
16-
required: false
17-
type: string
1815
docker:
1916
required: true
2017
type: string
@@ -54,10 +51,12 @@ jobs:
5451
matrix:
5552
folders: ${{ fromJson(inputs.folder_slices)[inputs.slice_id] }}
5653
runs-on:
57-
group: ${{ fromJson(inputs.runner_map)[matrix.folders][inputs.machine_type] }}
54+
group: '${{ inputs.machine_type }}'
5855
container:
5956
image: ${{ inputs.docker }}
6057
options: --gpus all --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
58+
outputs:
59+
machine_type: ${{ steps.set_machine_type.outputs.machine_type }}
6160
steps:
6261
- name: Echo input and matrix info
6362
shell: bash
@@ -111,6 +110,7 @@ jobs:
111110
run: pip freeze
112111

113112
- name: Set `machine_type` for report and artifact names
113+
id: set_machine_type
114114
working-directory: /transformers
115115
shell: bash
116116
run: |
@@ -126,6 +126,7 @@ jobs:
126126
127127
echo "$machine_type"
128128
echo "machine_type=$machine_type" >> $GITHUB_ENV
129+
echo "machine_type=$machine_type" >> $GITHUB_OUTPUT
129130
130131
- name: Run all tests on GPU
131132
working-directory: /transformers
@@ -159,5 +160,5 @@ jobs:
159160
job: run_models_gpu
160161
report_repo_id: ${{ inputs.report_repo_id }}
161162
gpu_name: ${{ inputs.runner_type }}
162-
machine_type: ${{ inputs.machine_type }}
163+
machine_type: ${{ needs.run_models_gpu.outputs.machine_type }}
163164
secrets: inherit

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ jobs:
8888
job: run_trainer_and_fsdp_gpu
8989
slack_report_channel: "#transformers-ci-daily-training"
9090
docker: huggingface/transformers-all-latest-gpu
91+
runner_type: "a10"
9192
ci_event: Daily CI
9293
report_repo_id: hf-internal-testing/transformers_daily_ci
9394
commit_sha: ${{ github.sha }}

.github/workflows/self-scheduled.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ jobs:
6868
outputs:
6969
folder_slices: ${{ steps.set-matrix.outputs.folder_slices }}
7070
slice_ids: ${{ steps.set-matrix.outputs.slice_ids }}
71-
runner_map: ${{ steps.set-matrix.outputs.runner_map }}
7271
quantization_matrix: ${{ steps.set-matrix-quantization.outputs.quantization_matrix }}
7372
steps:
7473
- name: Update clone
@@ -95,7 +94,6 @@ jobs:
9594
if [ "${{ inputs.job }}" = "run_models_gpu" ]; then
9695
echo "folder_slices=$(python3 ../utils/split_model_tests.py --models '${{ inputs.models }}' --num_splits ${{ env.NUM_SLICES }})" >> $GITHUB_OUTPUT
9796
echo "slice_ids=$(python3 -c 'd = list(range(${{ env.NUM_SLICES }})); print(d)')" >> $GITHUB_OUTPUT
98-
echo "runner_map=$(python3 ../utils/get_runner_map.py)" >> $GITHUB_OUTPUT
9997
elif [ "${{ inputs.job }}" = "run_trainer_and_fsdp_gpu" ]; then
10098
echo "folder_slices=[['trainer'], ['fsdp']]" >> $GITHUB_OUTPUT
10199
echo "slice_ids=[0, 1]" >> $GITHUB_OUTPUT
@@ -119,14 +117,13 @@ jobs:
119117
strategy:
120118
fail-fast: false
121119
matrix:
122-
machine_type: [single-gpu, multi-gpu]
120+
machine_type: [aws-g5-4xlarge-cache, aws-g5-12xlarge-cache]
123121
slice_id: ${{ fromJSON(needs.setup.outputs.slice_ids) }}
124122
uses: ./.github/workflows/model_jobs.yml
125123
with:
126124
folder_slices: ${{ needs.setup.outputs.folder_slices }}
127125
machine_type: ${{ matrix.machine_type }}
128126
slice_id: ${{ matrix.slice_id }}
129-
runner_map: ${{ needs.setup.outputs.runner_map }}
130127
docker: ${{ inputs.docker }}
131128
commit_sha: ${{ inputs.commit_sha || github.sha }}
132129
runner_type: ${{ inputs.runner_type }}
@@ -147,9 +144,10 @@ jobs:
147144
folder_slices: ${{ needs.setup.outputs.folder_slices }}
148145
machine_type: ${{ matrix.machine_type }}
149146
slice_id: ${{ matrix.slice_id }}
150-
runner_map: ${{ needs.setup.outputs.runner_map }}
151147
docker: ${{ inputs.docker }}
152148
commit_sha: ${{ inputs.commit_sha || github.sha }}
149+
runner_type: ${{ inputs.runner_type }}
150+
report_repo_id: ${{ inputs.report_repo_id }}
153151
report_name_prefix: run_trainer_and_fsdp_gpu
154152
secrets: inherit
155153

conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# by pytest before any tests are run
1717

1818
import doctest
19+
import os
1920
import sys
2021
import warnings
2122
from os.path import abspath, dirname, join
@@ -27,6 +28,7 @@
2728
HfDoctestModule,
2829
HfDocTestParser,
2930
is_torch_available,
31+
patch_testing_methods_to_collect_info,
3032
patch_torch_compile_force_graph,
3133
)
3234

@@ -145,3 +147,7 @@ def check_output(self, want, got, optionflags):
145147
# patch `torch.compile`: if `TORCH_COMPILE_FORCE_FULLGRAPH=1` (or values considered as true, e.g. yes, y, etc.),
146148
# the patched version will always run with `fullgraph=True`.
147149
patch_torch_compile_force_graph()
150+
151+
152+
if os.environ.get("PATCH_TESTING_METHODS_TO_COLLECT_OUTPUTS", "").lower() in ("yes", "true", "on", "y", "1"):
153+
patch_testing_methods_to_collect_info()
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
FROM intel/deep-learning-essentials:2025.1.3-0-devel-ubuntu24.04 AS base
2+
LABEL maintainer="Hugging Face"
3+
SHELL ["/bin/bash", "-c"]
4+
5+
ARG PYTHON_VERSION=3.12
6+
ENV DEBIAN_FRONTEND=noninteractive
7+
8+
RUN apt-get update && \
9+
apt-get install -y software-properties-common && \
10+
add-apt-repository -y ppa:deadsnakes/ppa && \
11+
apt-get update
12+
13+
RUN apt-get update && \
14+
apt-get -y install \
15+
apt-utils \
16+
build-essential \
17+
ca-certificates \
18+
clinfo \
19+
curl \
20+
git \
21+
git-lfs \
22+
vim \
23+
numactl \
24+
gnupg2 \
25+
gpg-agent \
26+
python3-dev \
27+
python3-opencv \
28+
unzip \
29+
ffmpeg \
30+
tesseract-ocr \
31+
espeak-ng \
32+
wget \
33+
ncurses-term \
34+
google-perftools \
35+
libjemalloc-dev \
36+
&& apt-get clean \
37+
&& rm -rf /var/lib/apt/lists/*
38+
39+
# Use virtual env because Ubuntu:24 does not allowed pip on original python
40+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
41+
ENV PATH="/root/.local/bin:$PATH"
42+
ENV VIRTUAL_ENV="/opt/venv"
43+
ENV UV_PYTHON_INSTALL_DIR=/opt/uv/python
44+
RUN uv venv --python ${PYTHON_VERSION} --seed ${VIRTUAL_ENV}
45+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
46+
47+
RUN pip install --upgrade pip wheel
48+
RUN pip install torch torchvision torchaudio torchcodec --index-url https://download.pytorch.org/whl/cpu --no-cache-dir
49+
RUN pip install av pyctcdecode pytesseract decord galore-torch fire scipy scikit-learn sentencepiece sentence_transformers sacremoses nltk rouge_score librosa soundfile mpi4py pytorch_msssim
50+
RUN pip install onnx optimum onnxruntime
51+
RUN pip install autoawq
52+
RUN pip install gptqmodel --no-build-isolation
53+
RUN pip install -U datasets timm transformers accelerate peft diffusers opencv-python kenlm evaluate
54+
RUN pip install -U intel-openmp
55+
56+
# install bitsandbytes
57+
RUN git clone https://github.com/bitsandbytes-foundation/bitsandbytes.git && cd bitsandbytes/ && \
58+
cmake -DCOMPUTE_BACKEND=cpu -S . && make && pip install . && cd ../
59+
60+
# CPU don't need triton
61+
RUN pip uninstall triton -y
62+
63+
ENV LD_PRELOAD=${LD_PRELOAD}:/opt/venv/lib/libiomp5.so:/usr/lib/x86_64-linux-gnu/libtcmalloc.so.4
64+
ENV KMP_AFFINITY=granularity=fine,compact,1,0
65+
66+
RUN touch /entrypoint.sh
67+
RUN chmod +x /entrypoint.sh
68+
RUN echo "#!/bin/bash" >> /entrypoint.sh
69+
RUN echo "/bin/bash" >> /entrypoint.sh
70+
71+
ENTRYPOINT ["/entrypoint.sh"]

docs/source/en/_toctree.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@
199199
title: HIGGS
200200
- local: quantization/hqq
201201
title: HQQ
202+
- local: quantization/mxfp4
203+
title: MXFP4
202204
- local: quantization/optimum
203205
title: Optimum
204206
- local: quantization/quanto
@@ -557,6 +559,8 @@
557559
title: Llama2
558560
- local: model_doc/llama3
559561
title: Llama3
562+
- local: model_doc/longcat_flash
563+
title: LongCatFlash
560564
- local: model_doc/longformer
561565
title: Longformer
562566
- local: model_doc/longt5
@@ -625,6 +629,8 @@
625629
title: OLMo
626630
- local: model_doc/olmo2
627631
title: OLMo2
632+
- local: model_doc/olmo3
633+
title: Olmo3
628634
- local: model_doc/olmoe
629635
title: OLMoE
630636
- local: model_doc/open-llama

docs/source/en/cache_explanation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ When you use Transformers' [`Cache`] class, the self-attention module performs s
8585

8686
Caches are structured as a list of layers, where each layer contains a key and value cache. The key and value caches are tensors with the shape `[batch_size, num_heads, seq_len, head_dim]`.
8787

88-
Layers can be of different types (e.g. `DynamicLayer`, `StaticLayer`, `SlidingWindowLayer`), which mostly changes how sequence length is handled and how the cache is updated.
88+
Layers can be of different types (e.g. `DynamicLayer`, `StaticLayer`, `StaticSlidingWindowLayer`), which mostly changes how sequence length is handled and how the cache is updated.
8989

9090
The simplest is a `DynamicLayer` that grows as more tokens are processed. The sequence length dimension (`seq_len`) increases with each new token:
9191

@@ -94,7 +94,7 @@ cache.layers[idx].keys = torch.cat([cache.layers[idx].keys, key_states], dim=-2)
9494
cache.layers[idx].values = torch.cat([cache.layers[idx].values, value_states], dim=-2)
9595
```
9696

97-
Other layer types like `StaticLayer` and `SlidingWindowLayer` have a fixed sequence length that is set when the cache is created. This makes them compatible with `torch.compile`. In the case of `SlidingWindowLayer`, existing tokens are shifted out of the cache when a new token is added.
97+
Other layer types like `StaticLayer` and `StaticSlidingWindowLayer` have a fixed sequence length that is set when the cache is created. This makes them compatible with `torch.compile`. In the case of `StaticSlidingWindowLayer`, existing tokens are shifted out of the cache when a new token is added.
9898

9999
The example below demonstrates how to create a generation loop with [`DynamicCache`]. As discussed, the attention mask is a concatenation of past and current token values and `1` is added to the cache position for the next token.
100100

docs/source/en/internal/generation_utils.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ A [`Constraint`] can be used to force the generation to include specific tokens
250250
- update
251251
- lazy_initialization
252252

253-
[[autodoc]] SlidingWindowLayer
253+
[[autodoc]] StaticSlidingWindowLayer
254254
- update
255255
- lazy_initialization
256256

docs/source/en/model_doc/apertus.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ specific language governing permissions and limitations under the License.
1313
rendered properly in your Markdown viewer.
1414
1515
-->
16+
*This model was released on 2025-09-02 and added to Hugging Face Transformers on 2025-08-28.*
17+
18+
# Apertus
1619

1720
<div style="float: right;">
1821
<div class="flex flex-wrap space-x-1">
@@ -23,7 +26,7 @@ rendered properly in your Markdown viewer.
2326
</div>
2427
</div>
2528

26-
# Apertus
29+
## Overview
2730

2831
[Apertus](https://www.swiss-ai.org) is a family of large language models from the Swiss AI Initiative.
2932

docs/source/en/model_doc/florence2.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ specific language governing permissions and limitations under the License.
1313
rendered properly in your Markdown viewer.
1414
1515
-->
16+
*This model was released on 2024-06-16 and added to Hugging Face Transformers on 2025-08-20.*
17+
18+
# Florence-2
1619

1720
<div style="float: right;">
1821
<div class="flex flex-wrap space-x-1">
@@ -21,7 +24,7 @@ rendered properly in your Markdown viewer.
2124
</div>
2225
</div>
2326

24-
# Florence-2
27+
## Overview
2528

2629
[Florence-2](https://huggingface.co/papers/2311.06242) is an advanced vision foundation model that uses a prompt-based approach to handle a wide range of vision and vision-language tasks. Florence-2 can interpret simple text prompts to perform tasks like captioning, object detection, and segmentation. It leverages the FLD-5B dataset, containing 5.4 billion annotations across 126 million images, to master multi-task learning. The model's sequence-to-sequence architecture enables it to excel in both zero-shot and fine-tuned settings, proving to be a competitive vision foundation model.
2730

@@ -44,7 +47,7 @@ from transformers import pipeline
4447

4548
pipeline = pipeline(
4649
"image-text-to-text",
47-
model="ducviet00/Florence-2-base-hf",
50+
model="florence-community/Florence-2-base",
4851
device=0,
4952
dtype=torch.bfloat16
5053
)

0 commit comments

Comments
 (0)