FluxML / GeometricFlux.jl

Geometric Deep Learning for Flux
https://fluxml.ai/GeometricFlux.jl/stable/
MIT License
348 stars 30 forks source link

Examples are not working #344

Closed kaansancak closed 2 years ago

kaansancak commented 2 years ago

I have been trying to run the examples, specifically this one: https://github.com/FluxML/GeometricFlux.jl/blob/master/examples/graphconv.jl.

I am getting the following error:

[ Info: Training on GPU
ERROR: LoadError: MethodError: no method matching getindex(::Cora, ::Int64)
Stacktrace:
 [1] load_data(dataset::Cora, batch_size::Int64, train_repeats::Int64, test_repeats::Int64) (repeats 2 times)
   @ Main /workspace/Julia/graphconv.jl:16
 [2] train(; kws::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Main /workspace/Julia/graphconv.jl:73
 [3] train()
   @ Main /workspace/Julia/graphconv.jl:57
 [4] top-level scope
   @ /workspace/Julia/graphconv.jl:116
in expression starting at /workspace/Julia/graphconv.jl:116

I am using Julia v 1.8.1. I have installed the latest versions of the listed dependencies.

yuehhua commented 2 years ago

It seems error occurs at loading data. Could you please check if you have MLDatasets installed?

kaansancak commented 2 years ago

Yes, MLDatasets is installed.

yuehhua commented 2 years ago

Is it using MLDatasets successfully? It's kind of weird and should don't raise error. I tested it on my computer and it got passed. What's MLDatasets version in your side?

yuehhua commented 2 years ago

Could you reproduce this?

julia> using MLDatasets

julia> cora = Cora()
dataset Cora:
  metadata    =>    Dict{String, Any} with 3 entries
  graphs      =>    1-element Vector{MLDatasets.Graph}

julia> cora[1]
Graph:
  num_nodes   =>    2708
  num_edges   =>    10556
  edge_index  =>    ("10556-element Vector{Int64}", "10556-element Vector{Int64}")
  node_data   =>    (features = "1433×2708 Matrix{Float32}", targets = "2708-element Vector{Int64}", train_mask = "140-trues BitVector", val_mask = "500-trues BitVector", test_mask = "1000-trues BitVector")
  edge_data   =>    nothing

julia> @which cora[1]
getindex(d::Cora, i) in MLDatasets at /home/yuehhua/.julia/packages/MLDatasets/eZ0Va/src/datasets/graphs/cora.jl:64
kaansancak commented 2 years ago

I am using MLDatasets v0.5.15. Here is the trace:

julia> using MLDatasets

julia> cora = Cora()
ERROR: MethodError: objects of type Module are not callable
Stacktrace:
 [1] top-level scope
   @ REPL[2]:1
yuehhua commented 2 years ago

The latest version is MLDatasets v0.7.4. Could you update to this version?

kaansancak commented 2 years ago

I have updated the packages, still getting the same error.

My packages:

  [052768ef] CUDA v3.12.0
  [587475ba] Flux v0.13.6
⌃ [7e08b658] GeometricFlux v0.13.4
  [3ebe565e] GraphSignals v0.7.3
⌃ [86223c79] Graphs v1.7.3
  [eb30cadb] MLDatasets v0.7.4
  [d96e819e] Parameters v0.12.3
  [92933f4c] ProgressMeter v1.7.2
  [10745b16] Statistics

Trace:

ERROR: LoadError: MethodError: no method matching getindex(::Cora, ::Int64)
Stacktrace:
 [1] load_data(dataset::Cora, batch_size::Int64, train_repeats::Int64, test_repeats::Int64) (repeats 2 times)
   @ Main /GCN.jl:16
 [2] train(; kws::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Main /GCN.jl:73
 [3] train()
   @ Main /GCN.jl:57
 [4] top-level scope
   @  /GCN.jl:116
in expression starting at /GCN.jl:116
yuehhua commented 2 years ago

Maybe you could fire an issue to MLDatasets since the error comes from MLDatasets.

Dsantra92 commented 2 years ago

Hi @kaansancak Updating GeometricFlux to the latest version 0.13.7 solves the issue. The 0.13.4 version is not using MLDatasets.jl. Reproduce:

(tmp.V2PSqe1wQb) pkg> add GeometricFlux@0.13.4
.
.
.
julia> @which Cora()
Cora() in GraphMLDatasets at /home/deebyo/.julia/packages/GraphMLDatasets/nsi8O/src/dataset.jl:41

You can update all the packages using using Pkg; Pkg.update(). If you cannot use the current version of GeometricFlux.jl use a temporary environment . Hope it solves the issue.

kaansancak commented 2 years ago

Hi @kaansancak Updating GeometricFlux to the latest version 0.13.7 solves the issue. The 0.13.4 version is not using MLDatasets.jl. Reproduce:

(tmp.V2PSqe1wQb) pkg> add GeometricFlux@0.13.4
.
.
.
julia> @which Cora()
Cora() in GraphMLDatasets at /home/deebyo/.julia/packages/GraphMLDatasets/nsi8O/src/dataset.jl:41

You can update all the packages using using Pkg; Pkg.update(). If you cannot use the current version of GeometricFlux.jl use a temporary environment . Hope it solves the issue.

This solved the issue, thank you!