Skip to content

fix: 修改visible_device参数报错和dense模型没有_router_replay_enabled属性报错#248

Open
xxyyrr598 wants to merge 2 commits into
modelscope:mainfrom
xxyyrr598:fix-small-bugs
Open

fix: 修改visible_device参数报错和dense模型没有_router_replay_enabled属性报错#248
xxyyrr598 wants to merge 2 commits into
modelscope:mainfrom
xxyyrr598:fix-small-bugs

Conversation

@xxyyrr598

Copy link
Copy Markdown

PR type

  • [ √] Bug Fix
  • New Feature
  • Document Updates
  • More Models or Datasets Support

PR information

本次 PR 修复了两个导致模型加载和 Server 启动失败的 Bug:

  1. 修复 Dense 模型加载报错 (AttributeError)
  • 文件:src/twinkle/model/transformers/transformers.py
  • 原因:代码直接访问 self._router_replay_enabled,但 Dense 模型并未初始化该属性。
  • 修改:改用 getattr(self, '_router_replay_enabled', False) 进行安全访问,兼容 Dense 模型。
  1. 修复 Server 启动报错 (TypeError)
  • 文件:src/twinkle/server/model/app.py (DeviceGroup 类)
  • 原因:device_utils.py 中的装饰器会自动将环境变量(如 CUDA_VISIBLE_DEVICES)注入到 device_group 字典的 visible_devices 字段中,但 DeviceGroup 类未定义该参数,导致实例化时参数不匹配报错。
  • 修改:在 DeviceGroup 类中补充 visible_devices 字段,以正确接收该参数。

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request safely accesses the _router_replay_enabled attribute using getattr in transformers.py to prevent potential AttributeErrors, and adds an optional visible_devices field to the DeviceGroup class in device_mesh.py. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant