CliMA / OceanParameterizations.jl

Machine learning (and uncertainty quantification?) of climate model parameterizations using differentiable (and probabilistic?) programming.
MIT License
21 stars 2 forks source link

@info exception with Flux.jl training neural nets #23

Closed adelinehillier closed 3 years ago

adelinehillier commented 3 years ago

This was an issue before but remains an issue in my latest PR #22 .

uw_train_NDE.jl script runs successfully (woohoo!), but when training the neural nets in lines 24-37, an exception is thrown multiple times:

[2020/12/08 22:43:25.124] ERROR Exception while generating log record in module OceanParameterizations.NeuralNetworks at /Users/adelinehillier/.julia/dev/OceanParameterizations.jl/src/NeuralNetworks/NeuralNetworks.jl:9 -@-> /Users/adelinehillier/.julia/dev/OceanParameterizations.jl/src/NeuralNetworks/NeuralNetworks.jl:9

On this line: https://github.com/CliMA/OceanParameterizations.jl/blob/f919cbd6e7ce79ed5177e1e35bb71c665a2c377c/src/NeuralNetworks/NeuralNetworks.jl#L9 in NeuralNetworks.jl. Hopefully we can track down why it's throwing this error so that we'll be able to see the loss at each iteration as we should!

ali-ramadhan commented 3 years ago

Hmmm, I wonder if src/NeuralNetworks.jl is just missing a using Statistics?

Error message seems kinda obscure but mean is only exported by Statistics and I was able to get a similar error:

julia> @info mean(4)
┌ Error: Exception while generating log record in module Main at REPL[1]:1
│   exception =
│    UndefVarError: mean not defined
│    Stacktrace:
│     [1] top-level scope at logging.jl:331
│     [2] eval(::Module, ::Any) at ./boot.jl:331
│     [3] eval_user_input(::Any, ::REPL.REPLBackend) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:134
│     [4] repl_backend_loop(::REPL.REPLBackend) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:195
│     [5] start_repl_backend(::REPL.REPLBackend, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:180
│     [6] run_repl(::REPL.AbstractREPL, ::Any; backend_on_current_task::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:292
│     [7] run_repl(::REPL.AbstractREPL, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288
│     [8] (::Base.var"#807#809"{Bool,Bool,Bool,Bool})(::Module) at ./client.jl:399
│     [9] #invokelatest#1 at ./essentials.jl:710 [inlined]
│     [10] invokelatest at ./essentials.jl:709 [inlined]
│     [11] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:383
│     [12] exec_options(::Base.JLOptions) at ./client.jl:313
│     [13] _start() at ./client.jl:506
└ @ Main REPL[1]:1
adelinehillier commented 3 years ago

Resolved, thanks!