From b3b694ecc6d0e591908f59c73a44b415891bfa73 Mon Sep 17 00:00:00 2001 From: JoKircher Date: Wed, 21 Oct 2026 12:54:06 +0200 Subject: [PATCH 1/3] Update to GraphNetCore 0.5 GraphNetCore 0.5 moves the stack to CUDA.jl and cuDNN 6.2, which allows a Reactant version that loads on Julia 1.13, so Julia >= 1.12 is supported again. - Compat: GraphNetCore 0.5, CUDA and cuDNN 6.2, JSON 1, SciMLBase 3, OrdinaryDiffEq 7, RecursiveArrayTools 4, DataInterpolations 10, Octopus 0.2.2 (the first version that allows CUDA 6), julia 1.12. - GraphNetCore renamed load/save! to load_checkpoint/save_checkpoint!. load_checkpoint now moves the optimiser state to the device itself, so drop the workaround that did this after loading. - JSON 1 parses objects to JSON.Object by default; pass dicttype=Dict{String,Any} so meta.json is still read as a Dict. - OrdinaryDiffEq 7 no longer provides Euler. Import it from OrdinaryDiffEqLowOrderRK, now a dependency, in the package, tests and examples. - Remove the GPUCompiler ~1.9 pin, a workaround for an incompatibility between older Reactant and newer GPUCompiler that current versions no longer have, and the never-used PreallocationTools dependency. - Test on the latest Julia in CI again. --- .github/workflows/CI.yml | 3 +- Project.toml | 26 +++++++-------- README.md | 4 +-- docs/Project.toml | 2 +- example/BallisticSmall/BallisticSmall.jl | 2 +- example/DamBreakSmall/DamBreakSmall.jl | 3 +- example/DamBreakSmall/DamBreakSmall_optuna.jl | 2 +- example/DamBreakSmall/Project.toml | 4 ++- src/GraphNetSim.jl | 32 ++++++++----------- src/config.jl | 2 +- src/dataset.jl | 4 +-- src/import_data/vtkToh5.jl | 2 +- src/utils.jl | 2 +- test/Project.toml | 1 + test/runtests.jl | 6 +--- test/test_converters.jl | 6 ++-- test/test_datasets.jl | 9 ++++-- test/test_wall_distance.jl | 5 ++- 18 files changed, 59 insertions(+), 56 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0d42ba0..a754c84 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -23,7 +23,8 @@ jobs: fail-fast: false matrix: version: - - '1.12' # only supported version: Julia 1.13 needs a newer Reactant, which needs CUDA/cuDNN versions GraphNetCore 0.4 does not allow + - '1.12' # minimum supported (Octopus requires Julia ≥ 1.12; see Project.toml [compat]) + - '1' # latest stable 1.x steps: - uses: actions/checkout@v7 - uses: julia-actions/setup-julia@v3 diff --git a/Project.toml b/Project.toml index 4588771..36de8fc 100644 --- a/Project.toml +++ b/Project.toml @@ -12,7 +12,6 @@ ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" -GPUCompiler = "61eb1bfa-7361-4325-ad38-22787b887f55" GraphNetCore = "7809f980-de1b-4f9a-8451-85f041491431" HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f" JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" @@ -25,9 +24,9 @@ MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54" Octopus = "49bb3e92-56cb-4d34-aed6-8ee8ef58b458" Optimisers = "3bd65402-5787-11e9-1adc-39752487f4e2" OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" +OrdinaryDiffEqLowOrderRK = "1344f307-1e59-4825-a18e-ace9aa3fa4c6" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" PointNeighbors = "1c4d5385-0a27-49de-8e2c-43b175c8985c" -PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" @@ -44,42 +43,41 @@ cuDNN = "02a925ec-e4fe-4b08-9a7e-0d78e3d38ccd" Adapt = "4.3.0" Aqua = "0.8" CSV = "0.10.15" -CUDA = "5.9.6" -GPUCompiler = "~1.9" +CUDA = "6.2" ChainRulesCore = "1.16.0 - 1" ComponentArrays = "0.15" DataFrames = "1.6" -DataInterpolations = "8.6.0" +DataInterpolations = "10" Distributions = "0.25" -GraphNetCore = "0.4.2" +GraphNetCore = "0.5" HDF5 = "0.17" JLD2 = "0.6" -JSON = "0.21" +JSON = "1" JuliaFormatter = "~2.2" KernelAbstractions = "0.9.39" LightXML = "0.9" Lux = "1.13 - 1" LuxCUDA = "0.3" MLUtils = "0.4.4 - 0.4" -Octopus = "0.2" +Octopus = "0.2.2" Optimisers = "0.4, 1" -OrdinaryDiffEq = "6.85 - 6" +OrdinaryDiffEq = "7" +OrdinaryDiffEqLowOrderRK = "2.2.6" Plots = "1.40.18" PointNeighbors = "0.6.3" -PreallocationTools = "0.4.34" Printf = "1" ProgressMeter = "1.7.0 - 1" Random = "1" ReadVTK = "0.2.6" -RecursiveArrayTools = "3.36.0" -SciMLBase = "2.7.0 - 2" +RecursiveArrayTools = "4" +SciMLBase = "3" SciMLSensitivity = "7.76 - 7" Setfield = "1.1.2" Statistics = "1" Test = "1" Zygote = "0.6, 0.7" -cuDNN = "1.4 - 1" -julia = "~1.12" +cuDNN = "6.2" +julia = "1.12" [extras] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" diff --git a/README.md b/README.md index 2ef9dd9..0f21218 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ The package is build upon [**GraphNetCore.jl**](https://github.com/una-auxme/Gra ## Requirements -- **Julia 1.12** (Julia 1.13 is not supported yet; it needs dependency versions that GraphNetCore v0.4 does not allow) -- Built on [GraphNetCore.jl](https://github.com/una-auxme/GraphNetCore.jl) **v0.4**, which uses a +- **Julia ≥ 1.12** +- Built on [GraphNetCore.jl](https://github.com/una-auxme/GraphNetCore.jl) **v0.5**, which uses a [Lux.jl](https://github.com/LuxDL/Lux.jl) `TrainState` and pulls in a CUDA-capable stack. - A CUDA-capable GPU is recommended for training (falls back to CPU when CUDA is unavailable). diff --git a/docs/Project.toml b/docs/Project.toml index b7ffb62..efc8e8f 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -4,4 +4,4 @@ GraphNetSim = "5ff66f56-808c-48e7-ac84-dd29877231f8" Optuna = "a5d0552b-b2dc-4f08-ac5c-85ca7d701b92" [compat] -julia = "~1.12" +julia = "1.12" diff --git a/example/BallisticSmall/BallisticSmall.jl b/example/BallisticSmall/BallisticSmall.jl index 045c674..bbc9148 100644 --- a/example/BallisticSmall/BallisticSmall.jl +++ b/example/BallisticSmall/BallisticSmall.jl @@ -8,7 +8,7 @@ using GraphNetSim -import OrdinaryDiffEq: Euler, Tsit5 +import OrdinaryDiffEq: Tsit5 import Optimisers: Adam # Generate dataset into data/ballistic_small if not already present diff --git a/example/DamBreakSmall/DamBreakSmall.jl b/example/DamBreakSmall/DamBreakSmall.jl index 7749588..61d8343 100644 --- a/example/DamBreakSmall/DamBreakSmall.jl +++ b/example/DamBreakSmall/DamBreakSmall.jl @@ -12,7 +12,8 @@ using GraphNetSim -import OrdinaryDiffEq: Euler, Tsit5 +import OrdinaryDiffEq: Tsit5 +import OrdinaryDiffEqLowOrderRK: Euler import Optimisers: Adam # Generate dataset into data/dam_break_small if not already present diff --git a/example/DamBreakSmall/DamBreakSmall_optuna.jl b/example/DamBreakSmall/DamBreakSmall_optuna.jl index ae086d4..50d83fd 100644 --- a/example/DamBreakSmall/DamBreakSmall_optuna.jl +++ b/example/DamBreakSmall/DamBreakSmall_optuna.jl @@ -23,7 +23,7 @@ using GraphNetSim using Optuna -import OrdinaryDiffEq: Euler +import OrdinaryDiffEqLowOrderRK: Euler import Optimisers: Adam, AdamW, RAdam # ── Dataset setup ──────────────────────────────────────────────────────── diff --git a/example/DamBreakSmall/Project.toml b/example/DamBreakSmall/Project.toml index ee2be45..38d9948 100644 --- a/example/DamBreakSmall/Project.toml +++ b/example/DamBreakSmall/Project.toml @@ -3,6 +3,7 @@ GraphNetSim = "5ff66f56-808c-48e7-ac84-dd29877231f8" Optimisers = "3bd65402-5787-11e9-1adc-39752487f4e2" Optuna = "a5d0552b-b2dc-4f08-ac5c-85ca7d701b92" OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" +OrdinaryDiffEqLowOrderRK = "1344f307-1e59-4825-a18e-ace9aa3fa4c6" [sources.GraphNetSim] path = "../.." @@ -10,4 +11,5 @@ path = "../.." [compat] Optimisers = "0.4, 1" Optuna = "0.2.1" -OrdinaryDiffEq = "6.85 - 6" +OrdinaryDiffEq = "7" +OrdinaryDiffEqLowOrderRK = "2.2.6" diff --git a/src/GraphNetSim.jl b/src/GraphNetSim.jl index 7bc3af0..752e073 100644 --- a/src/GraphNetSim.jl +++ b/src/GraphNetSim.jl @@ -38,7 +38,8 @@ using Plots import SciMLBase: ODEProblem, SecondOrderODEProblem # Newer OrdinaryDiffEq relocated `OrdinaryDiffEqAlgorithm` into its OrdinaryDiffEqCore # subpackage; alias it back to the original name so solver-type signatures stay unchanged. -import OrdinaryDiffEq: OrdinaryDiffEqCore, Tsit5, Euler +import OrdinaryDiffEq: OrdinaryDiffEqCore, Tsit5 +import OrdinaryDiffEqLowOrderRK: Euler const OrdinaryDiffEqAlgorithm = OrdinaryDiffEqCore.OrdinaryDiffEqAlgorithm import ProgressMeter: Progress @@ -408,7 +409,7 @@ function calc_norms(dataset, device, args) return quantities, e_norms, n_norms, o_norms end -# Bridge between GraphNetCore.load()'s 2-col df_step (step, loss) and the +# Bridge between GraphNetCore.load_checkpoint()'s 2-col df_step (step, loss) and the # 3-col schema (step, interval_idx, loss). Idempotent: 3-col input is left # unchanged. Legacy 2-col rows preserve their original interval indices in # `interval_idx`; `step` is rebuilt as a monotonic 1:N counter so historical @@ -560,9 +561,9 @@ function train_network(opt, ds_path, cp_path; kws...) outputs += ds_train.meta["features"][tf]["dim"] end - # GraphNetCore >= 0.4: load() returns (gns, df_train, df_valid). The optimiser + # load_checkpoint() returns (gns, df_train, df_valid). The optimiser # state now lives inside gns.train_state (df_step was dropped upstream). - gns, df_train, df_valid = load( + gns, df_train, df_valid = load_checkpoint( quantities, typeof(dims) <: AbstractArray ? length(dims) : dims, e_norms, @@ -577,12 +578,6 @@ function train_network(opt, ds_path, cp_path; kws...) cp_path, ) # geht mit dims oder dimensions of array - # The optimiser state lives inside `gns.train_state` (populated on a fresh start by the - # TrainState constructor, restored on resume). On resume GraphNetCore loads it from the - # (CPU) checkpoint without moving it to the device, so re-`device` it in place here to keep - # it co-located with the (GPU) parameters. - @set! gns.train_state.optimizer_state = device(gns.train_state.optimizer_state) - Lux.trainmode(gns.train_state.states) @info "Model built!" @@ -938,12 +933,13 @@ function train_gns!( _restore_online_normalisers!(frozen_state) end - # GraphNetCore >= 0.4: save! no longer appends to df_valid, so record - # the validation loss here (once per checkpoint). + # GraphNetCore >= 0.4: save_checkpoint! (save! before 0.5) does not + # append to df_valid, so record the validation loss here (once per + # checkpoint). push!(df_valid, [step, valid_error / ds_valid.meta["n_trajectories"]]) if valid_error / ds_valid.meta["n_trajectories"] < min_validation_loss - save!( + save_checkpoint!( gns, gns.train_state.optimizer_state, df_train, @@ -966,7 +962,7 @@ function train_gns!( println(" min_validation_loss: $min_validation_loss") println(" last_validation_loss: $last_validation_loss") end - save!( + save_checkpoint!( gns, gns.train_state.optimizer_state, df_train, df_valid, step, cp_path ) avg_loss = 0.0f0 @@ -1102,7 +1098,7 @@ function eval_network( outputs += ds_test.meta["features"][tf]["dim"] end - gns, _, _ = load( + gns, _, _ = load_checkpoint( quantities, typeof(dims) <: AbstractArray ? length(dims) : dims, e_norms, @@ -1112,7 +1108,7 @@ function eval_network( args.mps, args.layer_size, args.hidden_layers, - # v0.4 load() builds a Lux TrainState that requires a real optimiser even for + # load_checkpoint() builds a Lux TrainState that requires a real optimiser even for # eval/extrapolate (its optimiser state is unused here); pass a throwaway Adam. Optimisers.Adam(), device, @@ -1432,7 +1428,7 @@ function extrapolate_network( outputs += ds_test.meta["features"][tf]["dim"] end - gns, _, _ = load( + gns, _, _ = load_checkpoint( quantities, typeof(dims) <: AbstractArray ? length(dims) : dims, e_norms, @@ -1442,7 +1438,7 @@ function extrapolate_network( args.mps, args.layer_size, args.hidden_layers, - # v0.4 load() builds a Lux TrainState that requires a real optimiser even for + # load_checkpoint() builds a Lux TrainState that requires a real optimiser even for # eval/extrapolate (its optimiser state is unused here); pass a throwaway Adam. Optimisers.Adam(), device, diff --git a/src/config.jl b/src/config.jl index c0e3c22..3877331 100644 --- a/src/config.jl +++ b/src/config.jl @@ -119,7 +119,7 @@ function load_model_config(cp_path::String)::Union{ModelConfig,Nothing} isfile(path) || return nothing try - d = json_parsefile(path) + d = json_parsefile(path; dicttype=Dict{String,Any}) arch = d["architecture"] train = d["training"] return ModelConfig(; diff --git a/src/dataset.jl b/src/dataset.jl index 41328c5..6144083 100644 --- a/src/dataset.jl +++ b/src/dataset.jl @@ -90,7 +90,7 @@ function Dataset(datafile::String, metafile::String, args) ) end - meta = parse(Base.read(metafile, String)) + meta = parse(Base.read(metafile, String); dicttype=Dict{String,Any}) keys_traj = keystraj(datafile) meta["n_trajectories"] = length(keys_traj) meta["keys_trajectories"] = keys_traj @@ -135,7 +135,7 @@ function Dataset(split::Symbol, path::String, args) ) end - meta = parse(Base.read(joinpath(path, "meta.json"), String)) + meta = parse(Base.read(joinpath(path, "meta.json"), String); dicttype=Dict{String,Any}) datafile = get_file(split, path) keys_traj = keystraj(datafile) meta["n_trajectories"] = length(keys_traj) diff --git a/src/import_data/vtkToh5.jl b/src/import_data/vtkToh5.jl index cac91f1..490f949 100644 --- a/src/import_data/vtkToh5.jl +++ b/src/import_data/vtkToh5.jl @@ -504,7 +504,7 @@ function _install_provided_meta(meta_path::AbstractString, output::AbstractStrin dest = joinpath(dirname(abspath(output)), "meta.json") # Light structural check: every dynamic feature key `X[$t]` must have `X[1]` # in the written file, every static feature key must exist. - m = JSON.parsefile(meta_path) + m = JSON.parsefile(meta_path; dicttype=Dict{String,Any}) h5open(output, "r") do fid g = fid[first(keys(fid))] for (fn, spec) in get(m, "features", Dict()) diff --git a/src/utils.jl b/src/utils.jl index 3a577bd..ade72a1 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -436,7 +436,7 @@ function update_meta!(path::String, norm_type::Symbol) return meta_path end - meta = json_parsefile(meta_path) + meta = json_parsefile(meta_path; dicttype=Dict{String,Any}) conflicting_minmax = ("data_min", "data_max", "output_min", "output_max") conflicting_meanstd = ("data_mean", "data_std") diff --git a/test/Project.toml b/test/Project.toml index c8afe2e..13d9dbc 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -12,6 +12,7 @@ Lux = "b2108857-7c20-44ae-9111-449ecde12c47" MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54" Optimisers = "3bd65402-5787-11e9-1adc-39752487f4e2" OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" +OrdinaryDiffEqLowOrderRK = "1344f307-1e59-4825-a18e-ace9aa3fa4c6" PointNeighbors = "1c4d5385-0a27-49de-8e2c-43b175c8985c" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" diff --git a/test/runtests.jl b/test/runtests.jl index 3ae8efd..cd5780c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -12,11 +12,7 @@ include("generate_fixtures.jl") @testset "Method ambiguity" begin Aqua.test_ambiguities([GraphNetSim]) end - # Deps that are intentionally not `import`ed from src/, so exclude them from the - # stale-deps check: - # - GPUCompiler: deps-only version pin (see Project.toml [compat]), loaded - # transitively via CUDA/Reactant. - Aqua.test_all(GraphNetSim; ambiguities=false, stale_deps=(ignore=[:GPUCompiler],)) + Aqua.test_all(GraphNetSim; ambiguities=false) end include("test_converters.jl") diff --git a/test/test_converters.jl b/test/test_converters.jl index c9e62ce..cf15283 100644 --- a/test/test_converters.jl +++ b/test/test_converters.jl @@ -245,7 +245,7 @@ end pvd = _make_vtk_dataset(dir; T=5, with_acc=true) out = joinpath(dir, "train.h5") vtk_to_hdf5(pvd, out; write_meta=true, connectivity_radius=0.5) - meta = JSON.parsefile(joinpath(dir, "meta.json")) + meta = JSON.parsefile(joinpath(dir, "meta.json"); dicttype=Dict{String,Any}) @test meta["dims"] == 3 @test meta["trajectory_length"] == 5 @test Set(meta["feature_names"]) == @@ -272,7 +272,9 @@ end out = joinpath(outdir, "train.h5") vtk_to_hdf5(pvd, out; meta=provided) @test isfile(joinpath(outdir, "meta.json")) - @test JSON.parsefile(joinpath(outdir, "meta.json"))["dims"] == 3 + @test JSON.parsefile( + joinpath(outdir, "meta.json"); dicttype=Dict{String,Any} + )["dims"] == 3 end end diff --git a/test/test_datasets.jl b/test/test_datasets.jl index 9b5ab69..419a678 100644 --- a/test/test_datasets.jl +++ b/test/test_datasets.jl @@ -24,7 +24,8 @@ using LinearAlgebra using JSON using PointNeighbors using Random -import OrdinaryDiffEq: Tsit5, Euler +import OrdinaryDiffEq: Tsit5 +import OrdinaryDiffEqLowOrderRK: Euler import Optimisers: Adam # ───────────────────────────────────────────────────────────────────────────── @@ -232,7 +233,9 @@ for cfg in CONFIGS # finiteness/non-triviality. Pin the actual values against stats # recomputed from the raw HDF5 instead. @testset "B4: meanstd matches ground truth" begin - meta = JSON.parsefile(joinpath(cfg.path, "meta.json")) + meta = JSON.parsefile( + joinpath(cfg.path, "meta.json"); dicttype=Dict{String,Any} + ) result = data_meanstd(cfg.path) for field in ("velocity", "acceleration") @@ -1232,7 +1235,7 @@ for cfg in CONFIGS cfg_path = joinpath(cp_path, "model_config.json") @test isfile(cfg_path) - d = JSON.parsefile(cfg_path) + d = JSON.parsefile(cfg_path; dicttype=Dict{String,Any}) @test d["architecture"]["mps"] == 2 @test d["architecture"]["layer_size"] == 32 @test d["architecture"]["hidden_layers"] == 1 diff --git a/test/test_wall_distance.jl b/test/test_wall_distance.jl index 89be0a9..2ad3aed 100644 --- a/test/test_wall_distance.jl +++ b/test/test_wall_distance.jl @@ -68,7 +68,10 @@ end @testset "wall_distance gating (calc_norms, bounds-driven)" begin dev = GraphNetSim.cpu_device() args = GraphNetSim.Args() - base = JSON.parsefile(joinpath(@__DIR__, "fixtures", "ballistic_small", "meta.json")) + base = JSON.parsefile( + joinpath(@__DIR__, "fixtures", "ballistic_small", "meta.json"); + dicttype=Dict{String,Any}, + ) q_bounded, = GraphNetSim.calc_norms((; meta=deepcopy(base)), dev, args) From 053365dd4fdd594acda30e0343ca1e3eb102a9a7 Mon Sep 17 00:00:00 2001 From: JoKircher Date: Thu, 22 Oct 2026 12:56:46 +0200 Subject: [PATCH 2/3] Bump version to 0.4.0 Breaking under 0.x semver: the GraphNetCore 0.5 update moves users to CUDA.jl 6, OrdinaryDiffEq 7 (Euler and other low-order solvers now come from OrdinaryDiffEqLowOrderRK), JSON 1, SciMLBase 3, RecursiveArrayTools 4 and DataInterpolations 10. GraphNetSim's own API and its checkpoint format are unchanged. --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 36de8fc..ab24440 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "GraphNetSim" uuid = "5ff66f56-808c-48e7-ac84-dd29877231f8" -version = "0.3.0" +version = "0.4.0" authors = ["Josef Jouaux ", "JT "] [deps] From 69db6e490fcd3d17a9eb48c79e1a2cac7779e2f4 Mon Sep 17 00:00:00 2001 From: JoKircher Date: Thu, 22 Oct 2026 16:54:02 +0200 Subject: [PATCH 3/3] Fix the DamBreakSmall Optuna example The example could not run from a fresh checkout: - Its environment did not declare HDF5 and JSON, which test/generators.jl loads when the script includes it to generate the dataset. - It wrote the minmax and the mean/std statistics once up front, but update_meta! keeps only one statistic type in meta.json and removes the other, so every trial that sampled norm_type=:minmax failed. Write the statistics each trial needs right before it trains instead. --- example/DamBreakSmall/DamBreakSmall_optuna.jl | 10 +++++----- example/DamBreakSmall/Project.toml | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/example/DamBreakSmall/DamBreakSmall_optuna.jl b/example/DamBreakSmall/DamBreakSmall_optuna.jl index 50d83fd..77877da 100644 --- a/example/DamBreakSmall/DamBreakSmall_optuna.jl +++ b/example/DamBreakSmall/DamBreakSmall_optuna.jl @@ -39,11 +39,8 @@ end ds_path = "data/dam_break_small" -# Precompute both normalization statistics (reusable across trials). -# `update_meta!` writes one statistic type per call, so run both — the trial -# then selects between them via `norm_type` (:minmax / :meanstd). -update_meta!(ds_path, :minmax) -update_meta!(ds_path, :meanstd) +# Normalization statistics are written per trial (see `objective`): `update_meta!` +# keeps only one statistic type in meta.json at a time, removing the other. # ── Fixed training parameters ──────────────────────────────────────────── @@ -93,6 +90,9 @@ function objective(trial::Trial; params) lr_stop = params[:lr] * params[:lr_decay_ratio] + # Write the statistics this trial's norm_type needs; update_meta! drops the other type. + update_meta!(ds_path, params[:norm_type]) + min_val_loss = train_network( opt, ds_path, diff --git a/example/DamBreakSmall/Project.toml b/example/DamBreakSmall/Project.toml index 38d9948..4b8ed9c 100644 --- a/example/DamBreakSmall/Project.toml +++ b/example/DamBreakSmall/Project.toml @@ -1,5 +1,7 @@ [deps] GraphNetSim = "5ff66f56-808c-48e7-ac84-dd29877231f8" +HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f" +JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" Optimisers = "3bd65402-5787-11e9-1adc-39752487f4e2" Optuna = "a5d0552b-b2dc-4f08-ac5c-85ca7d701b92" OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" @@ -9,6 +11,8 @@ OrdinaryDiffEqLowOrderRK = "1344f307-1e59-4825-a18e-ace9aa3fa4c6" path = "../.." [compat] +HDF5 = "0.17" +JSON = "1" Optimisers = "0.4, 1" Optuna = "0.2.1" OrdinaryDiffEq = "7"