Skip to content

Commit 31764b7

Browse files
authored
Merge branch 'main' into unused_var
2 parents 4e74292 + 58e13b9 commit 31764b7

File tree

366 files changed

+3170
-1860
lines changed

Some content is hidden

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

366 files changed

+3170
-1860
lines changed
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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,8 @@
559559
title: Llama2
560560
- local: model_doc/llama3
561561
title: Llama3
562+
- local: model_doc/longcat_flash
563+
title: LongCatFlash
562564
- local: model_doc/longformer
563565
title: Longformer
564566
- local: model_doc/longt5

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: 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 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

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
<!--Copyright 2025 the HuggingFace Team. All rights reserved.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
15+
16+
⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be rendered properly in your Markdown viewer.
17+
18+
-->
19+
*This model was released on 2025-09-01 and added to Hugging Face Transformers on 2025-09-15.*
20+
21+
22+
# LongCatFlash
23+
24+
## Overview
25+
26+
The LongCatFlash model was proposed in [LongCat-Flash Technical Report](https://huggingface.co/papers/2509.01322) by the Meituan LongCat Team.
27+
LongCat-Flash is a 560B parameter Mixture-of-Experts (MoE) model that activates 18.6B-31.3B parameters dynamically (average ~27B). The model features a shortcut-connected architecture enabling high inference speed (>100 tokens/second) and advanced reasoning capabilities.
28+
29+
The abstract from the paper is the following:
30+
31+
*We present LongCat-Flash, a 560 billion parameter Mixture-of-Experts (MoE) language model featuring a dynamic computation mechanism that activates 18.6B-31.3B parameters based on context (average ~27B). The model incorporates a shortcut-connected architecture enabling high inference speed (>100 tokens/second) and demonstrates strong performance across multiple benchmarks including 89.71% accuracy on MMLU and exceptional agentic tool use capabilities.*
32+
33+
Tips:
34+
35+
- LongCat-Flash uses a unique shortcut-connected MoE architecture that enables faster inference compared to traditional MoE models
36+
- The model supports up to 128k context length for long-form tasks
37+
- Dynamic parameter activation makes it computationally efficient while maintaining high performance
38+
- Best suited for applications requiring strong reasoning, coding, and tool-calling capabilities
39+
- The MoE architecture includes zero experts (nn.Identity modules) which act as skip connections, allowing tokens to bypass expert computation when appropriate
40+
41+
This model was contributed by [Molbap](https://huggingface.co/Molbap).
42+
The original code can be found [here](https://huggingface.co/meituan-longcat/LongCat-Flash-Chat).
43+
44+
## Usage examples
45+
46+
The model is large: you will need 2x8 H100 to run inference.
47+
```python
48+
# launch_longcat.py
49+
from transformers import LongcatFlashForCausalLM, AutoTokenizer
50+
import torch
51+
52+
model_id = "meituan-longcat/LongCat-Flash-Chat"
53+
54+
tokenizer = AutoTokenizer.from_pretrained(model_id)
55+
56+
chat = [
57+
{"role": "user", "content": "Hello! What is the capital of France? What can you tell me about it?"},
58+
]
59+
60+
model = LongcatFlashForCausalLM.from_pretrained(
61+
model_id,
62+
tp_plan="auto",
63+
dtype=torch.bfloat16,
64+
)
65+
66+
inputs = tokenizer.apply_chat_template(
67+
chat, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
68+
69+
outputs = model.generate(inputs, max_new_tokens=30)
70+
print(tokenizer.batch_decode(outputs))
71+
```
72+
73+
To run with TP, you will need torchrun:
74+
75+
```bash
76+
torchrun --nproc_per_node=8 --nnodes=2 --node_rank=0 | 1 --rdzv-id <an_id> --rdzv-backend c10d --rdzv-endpoint $NODE_ID:$NODE_PORT --log-dir ./logs_longcat launch_longcat.py
77+
```
78+
79+
And you'll get a nice generation:
80+
```json
81+
[Round 0] USER:Hello! What is the capital of France? What can you tell me about it? ASSISTANT:Hello! 😊 The capital of France is Paris, one of the most famous and beloved cities in the world. Here’s a quick overview of what makes Paris special:
82+
1. Iconic Landmarks
83+
84+
Eiffel Tower – The global symbol of France, built in 1889 for the World's Fair.
85+
Notre-Dame Cathedral – A masterpiece of Gothic architecture (currently under restoration after the 2019 fire).
86+
Louvre Museum – The world’s largest art museum, home to the Mona Lisa and Venus de Milo.
87+
Sacré-Cœur Basilica – A stunning white church atop Montmartre with panoramic views.
88+
Arc de Triomphe – Honors French military victories, with the Tomb of the Unknown Soldier beneath it.
89+
Champs-Élysées – A glamorous avenue leading to the Arc de Triomphe, lined with shops and cafés.
90+
91+
2. Culture & Arts
92+
93+
Paris is the "City of Light" (La Ville Lumière), a nickname from its early adoption of street lighting and its role as a center of enlightenment.
94+
It’s a global hub for fashion (haute couture, Paris Fashion Week) and art (Impressionism, Picasso, Dali).
95+
Famous literary figures like Hemingway, Fitzgerald, and Sartre lived and wrote here.
96+
97+
3. Food & Cuisine
98+
99+
Croissants, baguettes, macarons, and crème brûlée are just a few of its culinary delights.
100+
Paris has over 100 Michelin-starred restaurants and countless cozy bistros.
101+
The Marché d’Aligre and Rue Mouffetard are great for fresh produce and local flavors.
102+
103+
4. History & Politics
104+
105+
Founded in the 3rd century BC by the Parisii tribe, it became a major European city under the Romans.
106+
The French Revolution (1789–1799) began here, leading to the fall of the monarchy.
107+
Today, it’s the political and economic heart of France, housing the French President’s residence (Élysée Palace) and the National Assembly.
108+
109+
**
110+
```
111+
112+
## LongcatFlashConfig
113+
114+
[[autodoc]] LongcatFlashConfig
115+
116+
## LongcatFlashPreTrainedModel
117+
118+
[[autodoc]] LongcatFlashPreTrainedModel
119+
- forward
120+
121+
## LongcatFlashModel
122+
123+
[[autodoc]] LongcatFlashModel
124+
- forward
125+
126+
## LongcatFlashForCausalLM
127+
128+
[[autodoc]] LongcatFlashForCausalLM

docs/source/en/model_doc/nllb.md

Lines changed: 9 additions & 9 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 2022-07-11 and added to Hugging Face Transformers on 2022-07-18.*
17+
18+
# NLLB
1619

1720
<div style="float: right;">
1821
<div class="flex flex-wrap space-x-1">
@@ -22,18 +25,15 @@ rendered properly in your Markdown viewer.
2225
</div>
2326
</div>
2427

25-
*This model was released on 2022-07-11 and added to Hugging Face Transformers on 2022-07-18.*
26-
27-
28-
# NLLB
28+
## Overview
2929

3030
[NLLB: No Language Left Behind](https://huggingface.co/papers/2207.04672) is a multilingual translation model. It's trained on data using data mining techniques tailored for low-resource languages and supports over 200 languages. NLLB features a conditional compute architecture using a Sparsely Gated Mixture of Experts.
3131

3232

3333
You can find all the original NLLB checkpoints under the [AI at Meta](https://huggingface.co/facebook/models?search=nllb) organization.
3434

3535
> [!TIP]
36-
> This model was contributed by [Lysandre](https://huggingface.co/lysandre).
36+
> This model was contributed by [Lysandre](https://huggingface.co/lysandre).
3737
> Click on the NLLB models in the right sidebar for more examples of how to apply NLLB to different translation tasks.
3838
3939
The example below demonstrates how to translate text with [`Pipeline`] or the [`AutoModel`] class.
@@ -120,17 +120,17 @@ visualizer("UN Chief says there is no military solution in Syria")
120120
>>> tokenizer("How was your day?").input_ids
121121
[256047, 13374, 1398, 4260, 4039, 248130, 2]
122122
```
123-
123+
124124
To revert to the legacy behavior, use the code example below.
125-
125+
126126
```python
127127
>>> from transformers import NllbTokenizer
128128

129129
>>> tokenizer = NllbTokenizer.from_pretrained("facebook/nllb-200-distilled-600M", legacy_behaviour=True)
130130
```
131-
131+
132132
- For non-English languages, specify the language's [BCP-47](https://github.com/facebookresearch/flores/blob/main/flores200/README.md#languages-in-flores-200) code with the `src_lang` keyword as shown below.
133-
133+
134134
- See example below for a translation from Romanian to German.
135135
```python
136136
>>> from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

docs/source/en/model_doc/sam2.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ 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-07-29 and added to Hugging Face Transformers on 2025-08-14.*
17+
18+
# SAM2
19+
1620
<div style="float: right;">
1721
<div class="flex flex-wrap space-x-1">
1822
<img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-DE3412?style=flat&logo=pytorch&logoColor=white">
@@ -21,8 +25,6 @@ rendered properly in your Markdown viewer.
2125
</div>
2226
</div>
2327

24-
# SAM2
25-
2628
## Overview
2729

2830
SAM2 (Segment Anything Model 2) was proposed in [Segment Anything in Images and Videos](https://ai.meta.com/research/publications/sam-2-segment-anything-in-images-and-videos/) by Nikhila Ravi, Valentin Gabeur, Yuan-Ting Hu, Ronghang Hu, Chaitanya Ryali, Tengyu Ma, Haitham Khedr, Roman Rädle, Chloe Rolland, Laura Gustafson, Eric Mintun, Junting Pan, Kalyan Vasudev Alwala, Nicolas Carion, Chao-Yuan Wu, Ross Girshick, Piotr Dollár, Christoph Feichtenhofer.

docs/source/en/model_doc/sam2_video.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ 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-07-29 and added to Hugging Face Transformers on 2025-08-14.*
17+
18+
# SAM2 Video
19+
1620
<div style="float: right;">
1721
<div class="flex flex-wrap space-x-1">
1822
<img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-DE3412?style=flat&logo=pytorch&logoColor=white">
@@ -21,8 +25,6 @@ rendered properly in your Markdown viewer.
2125
</div>
2226
</div>
2327

24-
# SAM2 Video
25-
2628
## Overview
2729

2830
SAM2 (Segment Anything Model 2) was proposed in [Segment Anything in Images and Videos](https://ai.meta.com/research/publications/sam-2-segment-anything-in-images-and-videos/) by Nikhila Ravi, Valentin Gabeur, Yuan-Ting Hu, Ronghang Hu, Chaitanya Ryali, Tengyu Ma, Haitham Khedr, Roman Rädle, Chloe Rolland, Laura Gustafson, Eric Mintun, Junting Pan, Kalyan Vasudev Alwala, Nicolas Carion, Chao-Yuan Wu, Ross Girshick, Piotr Dollár, Christoph Feichtenhofer.

i18n/README_zh-hans.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ checkpoint: 检查点
7979
</h4>
8080

8181
<h3 align="center">
82-
<p>为 Jax、PyTorch 和 TensorFlow 打造的先进的自然语言处理</p>
82+
<p>为 Jax、PyTorch 和 TensorFlow 打造的先进的自然语言处理函数库</p>
8383
</h3>
8484

8585
<h3 align="center">

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def run(self):
308308
extras["sigopt"] = deps_list("sigopt")
309309
extras["hub-kernels"] = deps_list("kernels")
310310

311-
extras["integrations"] = extras["hub-kernels"] + extras["optuna"] + extras["ray"] + extras["sigopt"]
311+
extras["integrations"] = extras["hub-kernels"] + extras["optuna"] + extras["ray"]
312312

313313
extras["serving"] = deps_list("openai", "pydantic", "uvicorn", "fastapi", "starlette") + extras["torch"]
314314
extras["audio"] = deps_list(

0 commit comments

Comments
 (0)