stack overflow issue
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 30/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- julia
调研方向
从用于 Lux.apply 的自定义 ChainRulesCore.rrule 开始,追踪其 Lux.apply forward 调用如何与 Zygote.pullback 交互。使用链接的 Discourse 讨论作为上下文;完成标准是该规则能够避免递归堆栈溢出,同时支持 Lux 模型的 checkpointed backpropagation。
由索引模型根据 Issue 内容生成。
描述
Hello
I have a memory-constrained problem with a Lux.jl model that uses Zygote for most of the backpropagation.
I tried to approach this from chainrules perspective I need to checkpoint each Lux.jl layer in neural network. So I tried to achieve it like that :
function ChainRulesCore.rrule(::typeof(Lux.apply), l::Lux.AbstractExplicitLayer, x, ps, st)
y = Lux.apply(l, x, ps, st)
function pullback_checkpointed(Δy)
y, pb =Zygote.pullback(Lux.apply,l, x, ps, st)
return NoTangent(), pb(Δy)
end
y, pullback_checkpointed
end
Rule gets invoked in backpropagation Hovewer the issue is that for some reason it try recursively to do backpropagation of the first line
y = Lux.apply(l, x, ps, st)
so I get stack overflow error; how to correct it?
I had also posted this issue in https://discourse.julialang.org/t/avoid-storing-intermediate-results-from-the-forward-pass-by-default/119694/4?u=jakub_mitura
- 主要语言
- Julia
- 星标
- 475
- 派生
- 98
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
JuliaDiff/ChainRules.jl 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
JuliaDiff/ChainRules.jl#844 ·
-
难度 2/5 1-3 小时 新手友好度 55/100
JuliaDiff/ChainRules.jl#818 ·
-
refactoring
难度 4/5 3-5 天 新手友好度 35/100
JuliaDiff/ChainRules.jl#815 ·
-
bug
难度 3/5 1-2 天 新手友好度 45/100
JuliaDiff/ChainRules.jl#810 ·
-
难度 5/5 一周以上 新手友好度 35/100
JuliaDiff/ChainRules.jl#803 · 4 条评论 ·
查看 JuliaDiff/ChainRules.jl 的全部 Issue
相似的 Issue
-
难度 2/5 1 小时以内 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
CliMA/ClimaAtmos.jl#4891 · 1 条评论 ·
维护者通常 1 天内回复
-
tagbot-manual
难度 1/5 1 小时以内 新手友好度 75/100
tshort/StaticCompiler.jl#191 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
SciML/SciMLSensitivity.jl#1703 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
JuliaGPU/GPUCompiler.jl#1008 ·
维护者通常 1 天内回复