GNNLux GATConv/GATv2Conv initialize the attention vector `a` without the setup rng, so it's identical for every seed
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- julia
调研方向
Issue 指向 GNNLux/src/layers/conv.jl 中 GATConv 和 GATv2Conv 的初始化器,大约在第 901 行和第 1058 行。阅读这些构造函数,并比较 GNNLux 的其他层如何将 setup RNG 传给 init_weight;issue 的最小示例展示了如何检查不同 seed 下的行为,以及如何使用仅接收 RNG 的初始化器进行检查。完成标准是两个 attention 向量都使用提供的 RNG,并且示例不再报告不同 seed 下的向量相同。
由索引模型根据 Issue 内容生成。
描述
In GNNLux, GATConv and GATv2Conv create the attention parameter a without passing the rng given to initialparameters:
a = l.init_weight(ein > 0 ? 3out : 2out, l.heads) # GATConv
a = l.init_weight(out, l.heads) # GATv2Conv
With the default glorot_uniform, the rng-less WeightInitializers method falls back to its internal fixed Xoshiro(1234), so a comes out the same no matter which rng is passed to Lux.setup. Every GAT layer with the same shape therefore starts with an identical attention vector, and changing the seed (e.g. for multiple runs or an ensemble) doesn't change it. A custom init_weight that only has an (rng, dims...) method would also fail here with a MethodError.
Minimal example
using GNNLux, Lux, Random
for L in (GATConv(3 => 4; heads = 2), GATv2Conv(3 => 4; heads = 2))
p0 = Lux.setup(Xoshiro(0), L)[1]
p1 = Lux.setup(Xoshiro(1), L)[1]
println(nameof(typeof(L)), ": a equal across seeds = ", p0.a == p1.a,
", first Dense weight equal across seeds = ", first(values(p0)).weight == first(values(p1)).weight)
end
# init_weight is called without an rng for `a`
calls = Any[]
myinit(rng::AbstractRNG, dims::Integer...) = (push!(calls, (typeof(rng), dims)); zeros(Float32, dims...))
myinit(dims::Integer...) = (push!(calls, ("no rng", dims)); zeros(Float32, dims...))
Lux.setup(Xoshiro(0), GATv2Conv(3 => 4; heads = 2, init_weight = myinit))
println(calls)
Output (Julia 1.13.3, GNNLux 0.3.0, Lux 1.31.6, WeightInitializers 1.3.5, CPU):
GATConv: a equal across seeds = true, first Dense weight equal across seeds = false
GATv2Conv: a equal across seeds = true, first Dense weight equal across seeds = false
Any[(Xoshiro, (8, 3)), (Xoshiro, (8, 3)), ("no rng", (4, 2))]
The Dense sublayers react to the seed, but a doesn't. The two lines above are unchanged on current master (54025c6), so I expect the same behaviour there, though I ran the example against the registered 0.3.0.
Expected
a should be drawn from the rng passed to initialparameters, i.e. l.init_weight(rng, ...), like the other GNNLux layers (GCNConv, GMMConv, NNConv, ...).
Related (smaller)
In GNNLux GATConv, dense_x and dense_e are built as Dense(... , use_bias = false) without passing init_weight (L888-889), so a custom init_weight only affects a. GATv2Conv passes init_weight to its dense_i/dense_j/dense_e. Happy to split this into a separate issue if you prefer.
- 主要语言
- Julia
- 星标
- 312
- 派生
- 76
- 平均合并
- 2 天 19 小时
- 30 天内合并 PR
- 13
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
JuliaGraphs/GraphNeuralNetworks.jl 的其他 Issue
-
gnngraphs
难度 4/5 3-5 天 新手友好度 45/100
JuliaGraphs/GraphNeuralNetworks.jl#733 ·
维护者通常 2 天内回复
-
maintainance
难度 3/5 1-2 天 新手友好度 45/100
JuliaGraphs/GraphNeuralNetworks.jl#725 ·
维护者通常 2 天内回复
-
GCNConv fails to compile with Reactant - MethodError可能已有人在做 @DHAKED440 于 8 天前认领。 未关闭gnnlib lux
难度 3/5 1-2 天 新手友好度 68/100
JuliaGraphs/GraphNeuralNetworks.jl#710 ·
维护者通常 2 天内回复
-
flux gnngraphs gnnlib
难度 4/5 3-5 天 新手友好度 45/100
JuliaGraphs/GraphNeuralNetworks.jl#702 · 1 条评论 ·
维护者通常 2 天内回复
-
maintainance
难度 5/5 一周以上 新手友好度 20/100
JuliaGraphs/GraphNeuralNetworks.jl#655 · 12 条评论 ·
维护者通常 2 天内回复
查看 JuliaGraphs/GraphNeuralNetworks.jl 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
MagneticResonanceImaging/MRIReco.jl#366 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 79/100
FluxML/Optimisers.jl#253 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
`poissonians` is not public, unlike `brownians` and `jumps`可能已有人在做 @isaacsas 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 86/100
SciML/ModelingToolkit.jl#5389 ·
维护者通常 2 天内回复
-
`lower_throw!` treats any function whose name contains `jl_error` etc. as a throw (kernel becomes a trap / segfault)可能已有人在做 @sasmith-14 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
JuliaGPU/GPUCompiler.jl#1088 ·
维护者通常 1 天内回复