Trying to train a variable GNN w/ GeometricFlux.jl

I am trying to train a gated graph neural network to predict molecular properties with GeometricFlux.jl: GitHub - FluxML/GeometricFlux.jl: Geometric Deep Learning for Flux

The inputs are FeaturedGraph objects of various morphologies. After quite a bit of trial-and-error, I have reached a point where the exception message is opaque to me and I do not know how to proceed. Code being used is here: Trying to train a variable GNN w/ GeometricFlux.jl · GitHub

The error message is: LoadError: MethodError: _pullback(::Zygote.Context, ::typeof(hcat)) is ambiguous.

Can @yuehhua or anyone else suggest what is wrong?

1 Like

You should provide more details. A minimum working example and in this case versions of your packages.

Julia 1.6.0
Flux 0.12.1
GeometricFlux 0.7.6
GraphSignals 0.1.13
LightGraphs 1.3.5
MetaGraphs 0.6.7
Zygote 0.6.13

Minimal code to reproduce idea and error:

using Flux, GeometricFlux, MetaGraphs

# convert a MetaGraph to FeaturedGraph
mg = MetaGraph()
add_vertices!(mg, 3)
add_edge!(mg, 1, 2)
add_edge!(mg, 2, 3)
adj_mat = adjacency_matrix(mg)
g = FeaturedGraph(adj_mat; nf=ones(2, nv(mg)))

# train the model
model = Chain(GatedGraphConv(2, 1, aggr=:mean), softmax)
loss(x, y) = Flux.mse(model(x), y)
@Flux.epochs 1 Flux.train!(
    loss, 
    Flux.params(model), 
    [(g, 1.0)], 
    ADAM()
)
1 Like

The related Stack overflow question: julia - Trying to train a variable GNN w/ GeometricFlux.jl - Stack Overflow I took a look at this but it’s beyond my understanding at the moment.

Sorry for being late. Could you give the full error messages? It seems like the error occurs on AD for hcat.