[Bug Report] `TransformerBridge.boot_*` methods are invisible to static type checkers
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
阅读 transformer_lens/model_bridge.py 以及报告中提到的三个源码位置:sources/transformers/__init__.py:31、sources/native/__init__.py:115 和 sources/tl_legacy.py:226。比较 boot_* 的签名,并决定如何向静态类型检查器公开这些签名,同时保持从 bridge 到 sources 的导入方向。完成标准是,像 TransformerBridge.boot_native(cfg) 这样的调用能够被识别,并具有带类型的返回值。
由索引模型根据 Issue 内容生成。
描述
boot_transformers, boot_native and boot_tl_legacy are attached to TransformerBridge at import time with setattr(TransformerBridge, "boot_...", staticmethod(boot)), in sources/transformers/__init__.py:31, sources/native/__init__.py:115 and sources/tl_legacy.py:226. Because the class body never declares them, static type checkers flag every call, even though the package ships py.typed:
from transformer_lens.model_bridge import TransformerBridge
model = TransformerBridge.boot_native(cfg)
# ty: Class `TransformerBridge` has no attribute `boot_native`
It also means no autocomplete and an untyped return value in editors.
Workaround: from transformer_lens.model_bridge.sources import boot_native. This works and is fully typed.
Possible fixes, which keep the bridge → sources import direction intact:
- Declare the methods on the class under
if TYPE_CHECKING:, using the source signatures, or - Define them as real
@staticmethods onTransformerBridgethat lazily import and delegate to the sourceboot.
Versions: transformer-lens 4.3.0, ty 0.0.97, Python 3.14
- 主要语言
- Python
- 星标
- 3.9k
- 派生
- 708
- 平均合并
- 1 天 4 小时
- 30 天内合并 PR
- 87
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TransformerLensOrg/TransformerLens 的其他 Issue
-
[Bug Report] test_faithfulness_recovery_is_graded_not_binary passes or fails on the sign of float32 rounding可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 77/100
TransformerLensOrg/TransformerLens#1993 ·
维护者通常 1 天内回复
-
[Bug Report] detect_head fails with a list of sequences and a custom tensor detection pattern可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug complexity-moderate TransformerBridge
难度 2/5 1-3 小时 新手友好度 76/100
TransformerLensOrg/TransformerLens#1979 ·
维护者通常 1 天内回复
-
[Proposal] MiniCPM adapter (MiniCPMForCausalLM) — I'm working on it可能已有人在做 @pablocs116 今天认领。 未关闭
TransformerLensOrg/TransformerLens#1992 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[Proposal] Pretrained J++ lenses through JacobianLens: artifact provenance and filtered readouts未关闭
难度 5/5 一周以上 新手友好度 45/100
TransformerLensOrg/TransformerLens#1991 ·
维护者通常 1 天内回复
-
[Proposal] Demo or helper for statistical audits of activation-patching results on TransformerBridge未关闭complexity-moderate enhancement TransformerBridge
难度 5/5 一周以上 新手友好度 28/100
TransformerLensOrg/TransformerLens#1988 · 3 条评论 ·
维护者通常 1 天内回复
查看 TransformerLensOrg/TransformerLens 的全部 Issue
相似的 Issue
-
binding:python bug
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
The Browser tab fails with a Wayland error when Open Terminal runs from a Wayland desktop session未关闭
难度 2/5 1-3 小时 新手友好度 78/100
open-webui/open-terminal#210 ·
-
triage/confirmed
难度 2/5 1-3 小时 新手友好度 78/100
agentscope-ai/agentscope#3807 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
NousResearch/hermes-agent#150542 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 91/100
triton-inference-server/server#9069 ·
维护者通常 1 天内回复