AI觉醒星球
Awakening is here
Knowledge File / 全球热点解读
2026-04-02 4 浏览 公开

版本更新:huggingface/transformers v5.5.0,提升开发者接入体验

HuggingFace Transformers 发布 v5.5.0 版本,新增 Gemma4 多模态模型、NomicBERT 长上下文文本嵌入模型和 MusicFlamingo 音频语言模型,并修复多项问题,优化缓存和开发者体验。

SOURCE / 全球热点解读 MIN / 4 ACCESS / 公开 POST / 2026-04-02 23:04:31

原贴

查看原文
作者:ArthurZucker 来源站点:github.com 原贴时间:

原文

Release v5.5.0 New Model additions Gemma4 Gemma 4 is a multimodal model with pretrained and instruction-tuned variants, available in 1B, 13B, and 27B parameters. The architecture is mostly the same as the previous Gemma versions. The key differences are a vision processor that can output images of fixed token budget and a spatial 2D RoPE to encode vision-specific information across height and width axis. You can find all the original Gemma 4 checkpoints under the Gemma 4 release. The key difference from previous Gemma releases is the new design to process images of different sizes using a fixed-budget number of tokens . Unlike many models that squash every image into a fixed square (like 224×224), Gemma 4 keeps the image's natural aspect ratio while making it the right size. There a a couple constraints to follow: The total number of pixels must fit within a patch budget Both height and width must be divisible by 48 (= patch size 16 × pooling kernel 3) Important Gemma 4 does not apply the standard ImageNet mean/std normalization that many other vision models use. The model's own patch embedding layer handles the final scaling internally (shifting values to the [-1, 1] range). The number of "soft tokens" (aka vision tokens) an image processor can produce is configurable. The supported options are outlined below and the default is 280 soft tokens per image. Soft Tokens Patches (before pooling) Approx. Image Area 70 630 ~161K pixels 140 1,260 ~323K pixels 280 2,520 ~645K pixels 560 5,040 ~1.3M pixels 1,120 10,080 ~2.6M pixels To encode positional information for each patch in the image, Gemma 4 uses a learned 2D position embedding table. The position table stores up to 10,240 positions per axis, which allows the model to handle very large images. Each position is a learned vector of the same dimensions as the patch embedding. The 2D RoPE which Gemma 4 uses independently rotate half the attention head dimensions for the x-axis and the other half for the y-axis. This allows the model to understand spatial relationships like "above," "below," "left of," and "right of." NomicBERT NomicBERT is a BERT-inspired encoder model that applies Rotary Position Embeddings (RoPE) to create reproducible long context text embeddings. It is the first fully reproducible, open-source text embedding model with 8192 context length that outperforms both OpenAI Ada-002 and OpenAI text-embedding-3-small on short-context MTEB and long context LoCo benchmarks. The model generates dense vector embeddings for various tasks including search, clustering, and classification using specific instruction prefixes. Links: Documentation | Paper Internalise the NomicBERT model ( #43067 ) by @ed22699 in #43067 MusicFlamingo Music Flamingo is a fully open large audio–language model designed for robust understanding and reasoning over music. It builds upon the Audio Flamingo 3 architecture by including Rotary Time Embeddings (RoTE), which injects temporal position information to enable the model to handle audio sequences up to 20 minutes. The model features a unified audio encoder across speech, sound, and music with special sound boundary tokens for improved audio sequence modeling. Links: Documentation | Paper Add Music Flamingo ( #43538 ) by @lashahub in #43538 Breaking changes Mamba and hybrid model caches are now first-class native citizens in the library, so users working with Mamba-based or hybrid (Mamba + attention) models should update their code to use the new native cache classes instead of any previous workarounds. 🚨 [Cache] Native mamba & hybrid cache ( #44950 ) by @Cyrilvallez Remote code execution support has been removed from the native LightGlue integration, so users who were loading LightGlue with trust_remote_code=True must remove that argument and use the model directly through the standard native API. 🚨 [ LightGlue ] Remove remote code execution ( #45122 ) by @vasqu Vision Several vision-related bugs were fixed in this release, including correcting the Gemma vision mask to support video inputs, resolving a dependency issue that incorrectly required torchvision for PIL-based image processors, and patching bugs in the Janus image generation model and image loading. Local code resolution for tokenizers and image processors was also corrected. Generalize gemma vision mask to videos ( #45185 ) by @zucchini-nlp in [ #45185 ] Fix explicit local code resolution for tokenizers and image processors ( #45169 ) by @hmellor in [ #45169 ] fix bug for janus model image generation ( #45044 ) by @kaixuanliu in [ #45044 ] [Bugfix] Remove incorrect torchvision requirement from PIL backend image processors ( #45045 ) by @Lidang-Jiang in [ #45045 ] Avoid Image.open failure ( #44645 ) by @sywangyi in [ #44645 ] Cache Improved the performance of repository checks ( check-repo ) by introducing file-level and AST-level disk caching, achieving up to a 27x speedup (from ~46s to ~1.6s with a warm cache), and fixed the mlinter cache location in .gitignore . refactoring: speedup static checks with disk cache ( #44992 ) by @tarekziade in [ #44992 ] refactor: added cache in check_repo ( #45012 ) by @tarekziade in [ #45012 ] chore: Fix mlinter cache location ( #45052 ) by @tarekziade in [ #45052 ] Bugfixes and improvements Fix resized LM head weights being overwritten by post_init ( #45079 ) by @javierdejesusda in [ #45079 ] [Qwen3.5 MoE] Add _tp_plan to ForConditionalGeneration ( #45124 ) by @danielquintas8 in [ #45124 ] fix(models): Fix dtype mismatch in SwitchTransformers and TimmWrapperModel ( #45074 ) by @harshaljanjani in [ #45074 ] [misc] fix qwen35 tests: correct the text model type and skip reverse_mapping ( #45173 ) by @JJJYmmm in [ #45173 ] 🔒 Pin GitHub Actions to commit SHAs ( #45180 ) by @paulinebm in [ #45180 ] Use doc-builder runnable example for GLM-ASR ( #44277 ) by @tarekziade in [ #44277 ] CI] Small T5 expectations updated ( #45138 ) by @Abdennacer-Badaoui in [ #45138 ] fix: correct type annotations across config classes for @strict validation ( #45007 ) by @Krishnachaitanyakc in [ #45007 ] Fix T5Attention shape mismatch under Tensor Parallelism ( #45109 ) by @aws-zhanxun in [ #45109 ] [refactor] Serving into proper modules ( #44796 ) by @SunMarc in [ #44796 ] Re-add regex substitutions to the response parsing spec ( #45166 ) by @Rocketknight1 in [ #45166 ] Fix incorrect TrainingArguments example in training.md ( #45150 ) by @maanas1234 in [ #45150 ] Add parse_response to Processor, make it a bit more official ( #45143 ) by @Rocketknight1 in [ #45143 ] DeepGEMM ( #44832 ) by @IlyasMoutawwakil in [ #44832 ] fix: prefer registered config over remote code in AutoConfig.from_pretrained ( #45094 ) by @HanFa in [ #45094 ] [serving] Fix continuous batching JSON response serialization ( #45057 ) by @NathanHB in [ #45057 ] Fix stupid test fetcher ( #45140 ) by @ydshieh in [ #45140 ] [CB] Add warmup feature ( #45112 ) by @remi-or in [ #45112 ] feature: added import complexity checker ( #45013 ) by @tarekziade in [ #45013 ] Fix tests for janus model ( #44739 ) by @kaixuanliu in [ #44739 ] CB improvements for serving ( #45063 ) by @SunMarc in [ #45063 ] [docs] continuous batching ( #44896 ) by @stevhliu in [ #44896 ] Fix few issues in Qwen_3_Omni_Moe ( #44848 ) by @Sai-Suraj-27 in [ #44848 ] Fix TypeError in rope validation when ignore_keys is a list ( #45069 ) by @Fr0do in [ #45069 ] Remove unused TensorFlow env var ( #45065 ) by @Sai-Suraj-27 in [ #45065 ] fix: add identity reverse_op to dequantize ops for save_pretrained ( #44983 ) by @Hyungkeun-Park-Nota in [ #44983 ] Fix when RoPE params are in kwargs ( #45049 ) by @zucchini-nlp in [ #45049 ] chore: update update_metdata.yml ( #45054 ) by @hf-security-analysis[bot] in [ #45054 ] [ FA ] Fix BC support for a few versions + add deprecation cycle ( #45061 ) by @vasqu in [ #45061 ] fix(testing): Fix Parakeet, Evolla, Pi0, and Phi-3 test failures on main CI ( #45004 ) by @harshaljanjani in [ #45004 ] Allow advanced users to override model_type in AutoConfig.from_pretrained ( #45058 ) by @hmellor in [ #45058 ] Fix failing SmolLM3IntegrationTest ( #45048 ) by @Sai-Suraj-27 in [ #45048 ] chore: remove old extras ( #45024 ) by @tarekziade in [ #45024 ] Embedding VLMs don't need a head ( #45000 ) by @zucchini-nlp in [ #45000 ] Fix GraniteConfig type hints to accept int for multiplier fields ( #45019 ) by @javierdejesusda in [ #45019 ] fix: preserve rotary_pct across save/load cycle in GPTNeoX configs ( #44985 ) by @Krishnachaitanyakc in [ #44985 ] Significant community contributions The following contributors have made significant changes to the library over the last release: @ed22699 Internalise the NomicBERT model ( #43067 ) @tarekziade Use doc-builder runnable example for GLM-ASR ( #44277 ) refactoring: speedup static checks with disk cache ( #44992 ) feature: added import complexity checker ( #45013 ) refactor: added cache in check_repo ( #45012 ) chore: remove old extras ( #45024 ) chore: Fix mlinter cache location ( #45052 ) refactor: speed up docstring checker ( #45009 ) @Krishnachaitanyakc fix: correct type annotations across config classes for @strict validation ( #45007 ) fix: preserve rotary_pct across save/load cycle in GPTNeoX configs ( #44985 ) @lashahub Add Music Flamingo ( #43538 ) @Lidang-Jiang [Bugfix] Remove incorrect torchvision requirement from PIL backend image processors ( #45045 )

中文翻译

发布 v5.5.0

新模型添加

Gemma4

Gemma 4 是一个多模态模型,具有预训练和指令微调变体,参数规模包括 1B、13B 和 27B。其架构与之前的 Gemma 版本大致相同。关键区别在于一个视觉处理器,能够输出固定 token 预算的图像,以及一个空间 2D RoPE,用于在高度和宽度轴上编码视觉特定信息。您可以在 Gemma 4 版本下找到所有原始 Gemma 4 检查点。与之前 Gemma 版本的关键区别在于新设计,使用固定 token 数量处理不同尺寸的图像。与许多将每张图像压缩为固定方形(如 224×224)的模型不同,Gemma 4 在调整图像大小的同时保持其自然宽高比。需要遵循一些约束:总像素数必须符合 patch 预算;高度和宽度必须能被 48 整除(= patch 大小 16 × 池化核 3)。重要提示:Gemma 4 不应用许多其他视觉模型使用的标准 ImageNet 均值/标准差归一化。模型自身的 patch 嵌入层在内部处理最终缩放(将值移至 [-1, 1] 范围)。图像处理器可生成的“软 token”(即视觉 token)数量是可配置的。支持的选项如下所示,默认为每张图像 280 个软 token。软 token、Patches(池化前)、大致图像面积:70、630、~161K 像素;140、1,260、~323K 像素;280、2,520、~645K 像素;560、5,040、~1.3M 像素;1,120、10,080、~2.6M 像素。为了对图像中每个 patch 的位置信息进行编码,Gemma 4 使用一个学习到的 2D 位置嵌入表。该位置表每轴最多存储 10,240 个位置,使模型能够处理非常大的图像。每个位置是一个学习到的向量,维度与 patch 嵌入相同。Gemma 4 使用的 2D RoPE 独立地将一半注意力头维度旋转用于 x 轴,另一半用于 y 轴。这使得模型能够理解空间关系,如“上方”、“下方”、“左侧”和“右侧”。

NomicBERT

NomicBERT 是一个受 BERT 启发的编码器模型,应用旋转位置嵌入(RoPE)创建可复现的长上下文文本嵌入。它是首个完全可复现、开源的文本嵌入模型,上下文长度为 8192,在短上下文 MTEB 和长上下文 LoCo 基准测试中均优于 OpenAI Ada-002 和 OpenAI text-embedding-3-small。该模型为各种任务生成密集向量嵌入,包括搜索、聚类和分类,使用特定的指令前缀。链接:文档 | 论文。Internalise the NomicBERT model ( #43067 ) by @ed22699 in #43067

MusicFlamingo

Music Flamingo 是一个完全开源的大型音频-语言模型,专为对音乐的稳健理解和推理而设计。它基于 Audio Flamingo 3 架构,增加了旋转时间嵌入(RoTE),注入时间位置信息,使模型能够处理长达 20 分钟的音频序列。该模型具有统一的音频编码器,涵盖语音、声音和音乐,并带有特殊的声音边界 token,以改进音频序列建模。链接:文档 | 论文。Add Music Flamingo ( #43538 ) by @lashahub in #43538

重大变更

Mamba 和混合模型缓存现已成为库中的一级原生公民,因此使用基于 Mamba 或混合(Mamba + 注意力)模型的用户应更新代码以使用新的原生缓存类,而不是之前的任何变通方法。🚨 [Cache] Native mamba & hybrid cache ( #44950 ) by @Cyrilvallez

从原生 LightGlue 集成中移除了远程代码执行支持,因此之前使用 trust_remote_code=True 加载 LightGlue 的用户必须移除该参数,并通过标准原生 API 直接使用模型。🚨 [ LightGlue ] Remove remote code execution ( #45122 ) by @vasqu

视觉

此版本修复了多个视觉相关错误,包括修正 Gemma 视觉掩码以支持视频输入,解决了一个依赖问题(该问题错误地要求 torchvision 用于基于 PIL 的图像处理器),并修补了 Janus 图像生成模型和图像加载中的错误。还修正了分词器和图像处理器的本地代码解析。Generalize gemma vision mask to videos ( #45185 ) by @zucchini-nlp in [ #45185 ] Fix explicit local code resolution for tokenizers and image processors ( #45169 ) by @hmellor in [ #45169 ] fix bug for janus model image generation ( #45044 ) by @kaixuanliu in [ #45044 ] [Bugfix] Remove incorrect torchvision requirement from PIL backend image processors ( #45045 ) by @Lidang-Jiang in [ #45045 ] Avoid Image.open failure ( #44645 ) by @sywangyi in [ #44645 ]

缓存

改进了仓库检查(check-repo)的性能,通过引入文件级和 AST 级磁盘缓存,实现了高达 27 倍的加速(从约 46 秒到热缓存时的约 1.6 秒),并修复了 .gitignore 中的 mlinter 缓存位置。refactoring: speedup static checks with disk cache ( #44992 ) by @tarekziade in [ #44992 ] refactor: added cache in check_repo ( #45012 ) by @tarekziade in [ #45012 ] chore: Fix mlinter cache location ( #45052 ) by @tarekziade in [ #45052 ]

错误修复与改进

Fix resized LM head weights being overwritten by post_init ( #45079 ) by @javierdejesusda in [ #45079 ] [Qwen3.5 MoE] Add _tp_plan to ForConditionalGeneration ( #45124 ) by @danielquintas8 in [ #45124 ] fix(models): Fix dtype mismatch in SwitchTransformers and TimmWrapperModel ( #45074 ) by @harshaljanjani in [ #45074 ] [misc] fix qwen35 tests: correct the text model type and skip reverse_mapping ( #45173 ) by @JJJYmmm in [ #45173 ] 🔒 Pin GitHub Actions to commit SHAs ( #45180 ) by @paulinebm in [ #45180 ] Use doc-builder runnable example for GLM-ASR ( #44277 ) by @tarekziade in [ #44277 ] CI] Small T5 expectations updated ( #45138 ) by @Abdennacer-Badaoui in [ #45138 ] fix: correct type annotations across config classes

[以下内容已截断,原文仍保留在数据库中。]

来源:ArthurZucker 分数:72

核心信息

HuggingFace Transformers 发布 v5.5.0 版本,新增 Gemma4 多模态模型、NomicBERT 长上下文文本嵌入模型和 MusicFlamingo 音频语言模型,并修复多项问题,优化缓存和开发者体验。

  • HuggingFace Transformers v5.5.0 发布,新增三款重磅模型
  • Gemma 4 支持非对称图像编码,适配任意宽高比
  • NomicBERT 开源且优于 OpenAI Ada-002,适合RAG
  • MusicFlamingo 可处理长达20分钟的音频
  • 缓存加速27倍,开发者需迁移Mamba缓存代码

详细解读

信号解读

HuggingFace Transformers v5.5.0 的发布标志着开源 AI 生态在三个关键方向上的加速:多模态推理、长上下文文本嵌入和音频理解。Gemma 4 引入了非对称图像编码(保持宽高比的固定token预算),这是对传统视觉模型(如 ViT 的固定分辨率)的显着改进;NomicBERT 第一次在开源模型中实现了对 OpenAI 闭源嵌入模型(Ada-002)的超越,且完全可复现;MusicFlamingo 则为音乐行业的 AI 应用提供了基础模型。

为什么重要

对于 AI 开发者和企业用户,这些变化意味着:1)多模态任务(如视觉问答)现在有了更高效的编码方案,尤其适合需要处理不规则尺寸图像的应用(如文档、截图);2)文本嵌入不再依赖闭源服务,NomicBERT 的 8192 上下文长度和开源属性降低了检索增强生成(RAG)的部署成本和风险;3)音频-语言模型扩展到 20 分钟序列,打开了长音频分析(如播客、会议记录)的实践空间。此外,缓存加速和 bug 修复直接提升了开发者日常迭代效率。

对谁有价值

主要价值对象包括:使用 Transformers 库进行模型微调或推理的工程师(需要更新缓存代码)、构建多模态搜索或内容理解产品的团队(可评估 Gemma 4 的图像编码方式)、以及寻求替代 OpenAI 嵌入模型的 RAG 开发者(NomicBERT 是低成本选择)。

行动建议

  • 立即更新 Transformers 库至 v5.5.0,并测试 Mamba/混合缓存的迁移,以利用性能提升。
  • 对于图像处理场景,试用 Gemma 4 的 soft token 配置(默认 280 可调),验证其在非正方形图像上的表现。
  • 在 RAG 流水线中替换 text-embedding-3-small 为 NomicBERT,使用其提供的指令前缀进行 MTEB 基准测试。
  • 探索 MusicFlamingo 在音乐推荐或音频摘要任务中的适用性,注意其 20 分钟上限。

风险与限制

Gemma 4 仍处于早期阶段(基于较新架构),社区生态不如已成熟的 ViT 模型;NomicBERT 在长上下文 LoCo 基准上虽优于 OpenAI,但不同领域(如法律、医学)需自行验证;MusicFlamingo 对非音乐音频(如纯语音)的鲁棒性未充分说明。此外,移除远程代码执行可能导致部分旧有 LightGlue 集成失效,需及时适配。

信息差价值

信息差价值:大多数开发者仍依赖闭源嵌入模型或传统视觉模型,而 v5.5.0 提供了性能更优且透明的开源替代方案。Gemma 4 的固定token预算设计可能成为处理不规则图像的新范式,目前尚未广泛讨论。NomicBERT 的开源可复现特性为合规性敏感的场景(如金融、医疗)打开了低成本嵌入的大门。

业务启发:对于内容平台,可整合 Gemma 4 的视觉编码提升商品图片搜索准确率;对于知识库产品,替换为 NomicBERT 可降低推理成本的同时保持甚至提升检索质量;音频类应用(如播客工具)可基于 MusicFlamingo 构建智能摘要功能。这些方向均能快速形成差异化体验。

可沉淀动作:1)更新 Transformers 库后,将现有 Mamba 模型缓存迁移至新原生类,并记录迁移后的性能数据;2)在内部 Benchmark 中对比 NomicBERT 与当前使用嵌入模型的准确率和延迟,形成选型报告;3)试用 Gemma 4 的多模态能力,输出一个最小可行性 demo(如图文问答),评估其生产化潜力。

参考来源

上一篇 版本更新:langchain-ai/langchain 1.2.24,提升开发者接入体验 下一篇 趋势解读:The latest AI news we announced in March,解读最新研究结论