RecursionError when initializing KumoTabular with pretrained=True after #1153
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 74/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
调研方向
从 sdm/models/kumo/tabular/model.py 开始,查看 KumoTabular 构造函数约第 139 行,其中 pretrained 分支将 _load_from_pretrained() 的返回值赋给 self.models[task]。阅读该方法,确认它返回 self 并且是原地加载权重。删除这一赋值,使调用只加载权重,然后使用 pretrained=True 构造模型,确认 self.eval() 能够完成。当该构造成功且没有 RecursionError 时即完成;现有的表格模型测试也应通过。
由索引模型根据 Issue 内容生成。
描述
Description
Initializing KumoTabular with pretrained=True raises a
RecursionError during the constructor's self.eval() call.
This appears to be a regression introduced by #1153.
Reproduction
model = sdm.models.KumoTabular(
task="classification",
size="large",
pretrained=True,
device=device,
)
Actual behavior
Initialization fails with:
File sdm/models/kumo/tabular/model.py:139, in KumoTabular.__init__
self.eval()
File torch/nn/modules/module.py, in Module.eval
return self.train(False)
RecursionError: maximum recursion depth exceeded
Expected behavior
The pretrained model should initialize successfully in evaluation mode.
Suspected cause
#1153 changed _load_from_pretrained() to return self rather than
an individual task model, but the constructor still assigns its return
value to a child module:
self.models[task] = self._load_from_pretrained(size, device=device)
This effectively executes self.models[task] = self, creating a circular
module reference:
KumoTabular -> models -> KumoTabular
The subsequent self.eval() recursively traverses this cycle.
Suggested fix
Remove the assignment in the constructor:
if pretrained:
- self.models[task] = self._load_from_pretrained(size, device=device)
+ self._load_from_pretrained(size, device=device)
The loader already loads the weights into each task model in place via
model.load_state_dict(ckpt, assign=True).
Environment
- Python: 3.12
- Installation: local source checkout
- Related PR: #1153
- 主要语言
- Python
- 星标
- 358
- 派生
- 33
- 平均合并
- 1 天 7 小时
- 30 天内合并 PR
- 182
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NVIDIA/structured-data-models 的其他 Issue
-
Kumo-Tabular weights unreachable behind restrictive egress proxies (Xet + plain HTTP both fail)可能已有人在做 @JGagacheva 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 67/100
NVIDIA/structured-data-models#1091 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
NIM error未关闭
难度 4/5 1-3 小时 新手友好度 15/100
NVIDIA/structured-data-models#1136 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
NVIDIA/structured-data-models#1071 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 32/100
NVIDIA/structured-data-models#1022 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 42/100
NVIDIA/structured-data-models#947 · 1 个 reaction ·
维护者通常 1 天内回复
查看 NVIDIA/structured-data-models 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
common-workflow-language/cwl-utils#477 ·
维护者通常 1 天内回复
-
Add dependabot未关闭feat
难度 2/5 1 小时以内 新手友好度 72/100
open-nudge/opentemplate#204 ·
维护者通常 1 天内回复
-
github-stale-ci-pr-closer: KV state is double-wrapped, never persists, and hits the depth-32 limit可能已有人在做 @VascoSch92 今天认领。 未关闭priority:medium ready-for-dev
难度 2/5 1-3 小时 新手友好度 72/100
OpenHands/extensions#781 ·
维护者通常 1 天内回复
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
curriculum documentation quality
难度 2/5 1-3 小时 新手友好度 78/100
githubnext/gh-aw-workshop#4638 ·
维护者通常 1 天内回复