Skip to content

[BUG] Florence-2 在 transformers 5.9.0 下报错:'Florence2LanguageConfig' object has no attribute 'forced_bos_token_id' #28

Description

@yandujun363

描述
使用 MZ_Florence2CLIPTextEncode 节点反推图片时,报错如下:

AttributeError: 'Florence2LanguageConfig' object has no attribute 'forced_bos_token_id'

复现步骤

  1. 添加 MZ_Florence2CLIPTextEncode 节点
  2. 连接图片和 CLIP
  3. 运行工作流
  4. 报错如上

环境信息

  • ComfyUI 版本:v0.22.0
  • transformers 版本:5.9.0
  • Python 版本:3.11.15
  • 系统:Windows
  • GPU:RTX 2050 (4GB)

原因分析
transformers 5.x 中 PretrainedConfig 基类的行为发生变化,不再默认定义 forced_bos_token_id 属性。但 configuration_florence2.py 中直接访问了 self.forced_bos_token_id,导致报错。

具体位置:

File: configuration_florence2.py, line 265
if self.forced_bos_token_id is None and kwargs.get("force_bos_token_to_be_generated", False):

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions