Skip to content

Commit

Permalink
Merge pull request #945 from SciML/ap/lux1.0
Browse files Browse the repository at this point in the history
fix!: update to Lux & Boltz 1.0
  • Loading branch information
avik-pal authored Sep 17, 2024
2 parents d2d2b47 + 3586821 commit f1843f3
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 293 deletions.
3 changes: 2 additions & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ steps:
RETESTITEMS_NWORKERS: 1 # These tests require quite a lot of GPU memory
GROUP: CUDA
DATADEPS_ALWAYS_ACCEPT: 'true'
JULIA_PKG_SERVER: "" # it often struggles with our large artifacts
JULIA_PKG_SERVER: ""

- label: "Documentation"
plugins:
Expand All @@ -42,5 +42,6 @@ steps:
DATADEPS_ALWAYS_ACCEPT: true
JULIA_DEBUG: "Documenter"
SECRET_DOCUMENTER_KEY: "AdqcYtp4x3U5j1ELurHIoOwURqXcOan+qmihqVjsjhoGUzS/snTyZNQ5fxaJr8Yawm9CyyGvh+Q5O98St1LJ9S+pi9C5TFSbPWnNp/vXabMmeUEVLHVYHUeR2wgMCciSnM/oLw5sNAEj3hrWFjLslEGKQSptUCTWuU5WRizhQONDxeA3tz9biZUYvKanP8GjsHUkD3te15n1t6o78T1+EJxb1znrBSd9aK1Y4UaVjBEfVtLtTD8Z6VP1L4SVXVipxrDdzwzbzUDaTpvjo3z3e9qx2u6Xn5qa/os6JY81jRa5ZTWFkev73DYhoFmordSI85grOPwNpvrNWqOAs5kTDg==;U2FsdGVkX1+TXM0w98SRH5lY0Dw+nmRJ1xtJmffK+GVWHdMjhiIxQoYGGoP065hgl1VOf+oLzqWWFoYIfcz5i/VKD5F7O3EhfLdcmG2Y15u4sxr/hLKKMedSCueiusNd4N9EGGmJ4LLY0I1K6vA8Pa2eRwE+yDE+wfSpqpTC3yxMo40Xk7wra6ZwAybGpSHzOItV+2QGHttr/WLntRbx7GD8HDBC/LGNhtmFzFhAo/2CiQ0qgMDHBxyVqZlAdCW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fxFDmDzaUeQcZwbBNVlfp51Gsc+LvYoyXMUhBu53wQgNmq+ZJCSO4V+XBIgJAKIOSlVDq0GXe1VtyfNC4XcU0ey84K0/mD3RmtNGc2YYNp6OPqwzJAIexQcSr8pehN53fqGuGrRX3EqPzxNZwM7W+VzzpT+Ky2jpLl2YrQyuROIAMV09P8HoDxBorSHAQXkijs2ByIAGbQqJhwtbcovSPIMqvHPeKKMuFfNzKnmCkUysklNxQynM2clwKwbOchghZOBNH2sQ4atfhHjdo66dXtzSmngyPujZcwinq1b1VUbG1n9BuusgdUrhpt/28MJRYLt4tJFVBqYGu98Ewa1oX+7xqCmhEe2us43fg7EYBpwLBAVDNsohVO69upLR+Yy2C1lhqJSSbO+JLKg70/7onpMI8JcCtiNYOMFYMix9ynkpBf8gN+cM/VgL4cldHYwbaAJXgnD7PxdmDIy7r8oZnGOHE//a3iDyB+Xqy0t9c41OYYn6PkB32BqRHFUvbzU+6kaDpQD/gk0EBTb51SLmy3IBBLKpKw1R0CVfS2wY5XX7vYYpgAMQzsoZpL3Ep0NpcRqtutcec0o0VXkd3B9wXJhDG+en0MaY9vc6V4g+nT8Z2jZw0A6lXnbDxlQN/CmvvrcsexHGGIj6vjpQs/oSyvOYaD1gVTWdQgcPhCYZGVH5O/llnKfxsRFVU3g6XvL4ND0oQ7S98eHRhz+8TqOx9Se47vEEC1O3bNDf6Rnnm+aB9vD0GKQ6iAETWI74yF5HrCpZY2XIDK8OgOQJoiWpDWaDxfNjK8nWMSjV8bnEdIzLP08p8fLWP/+JPeJkUB91mxmi5mhMjKFpKo/lXtvM2E8zmzkjo/VyLGYaij7EgF1XNIWRC5LWlsrrPiqVfQlmftDzjaG+jCx/47NLws="
JULIA_PKG_SERVER: ""
if: build.message !~ /\[skip docs\]/ && !build.pull_request.draft
timeout_in_minutes: 1000
2 changes: 0 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ jobs:
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
with:
coverage: false
env:
GROUP: ${{ matrix.group }}
- uses: julia-actions/julia-processcoverage@v1
Expand Down
16 changes: 8 additions & 8 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DiffEqFlux"
uuid = "aae7a2af-3d4f-5e19-a356-7da93b79d9d0"
authors = ["Chris Rackauckas <accounts@chrisrackauckas.com>"]
version = "3.6.0"
version = "4.0.0"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand All @@ -18,6 +18,7 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SciMLSensitivity = "1ed8b502-d754-442c-8d5d-10ac956f44a1"
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"

[weakdeps]
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
Expand All @@ -29,7 +30,7 @@ DiffEqFluxDataInterpolationsExt = "DataInterpolations"
ADTypes = "1.5"
Aqua = "0.8.7"
BenchmarkTools = "1.5.0"
Boltz = "0.4.2"
Boltz = "1"
ChainRulesCore = "1"
ComponentArrays = "0.15.17"
ConcreteStructs = "0.2"
Expand All @@ -46,11 +47,10 @@ ForwardDiff = "0.10"
Hwloc = "3"
InteractiveUtils = "<0.0.1, 1"
LinearAlgebra = "1.10"
Lux = "0.5.65"
Lux = "1"
LuxCUDA = "0.3.2"
LuxCore = "0.1"
LuxLib = "0.3.50"
MLDatasets = "0.7.14"
LuxCore = "1"
LuxLib = "1.2"
NNlib = "0.9.22"
OneHotArrays = "0.2.5"
Optimisers = "0.3"
Expand All @@ -65,6 +65,7 @@ Reexport = "0.2, 1"
SciMLBase = "2"
SciMLSensitivity = "7"
Setfield = "1.1.1"
Static = "1.1.1"
Statistics = "1.10"
StochasticDiffEq = "6.68.0"
Test = "1.10"
Expand All @@ -87,7 +88,6 @@ ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Hwloc = "0e44f5e4-bd66-52a0-8798-143a42290a1d"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
LuxCUDA = "d0bbae9a-e099-4d5b-a835-1c6931763bda"
MLDatasets = "eb30cadb-4394-5ae3-aed4-317e484a6458"
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
OneHotArrays = "0b1bfda6-eb8a-41d2-88d8-f5af5cad476f"
Optimisers = "3bd65402-5787-11e9-1adc-39752487f4e2"
Expand All @@ -105,4 +105,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[targets]
test = ["Aqua", "BenchmarkTools", "ComponentArrays", "DataInterpolations", "DelayDiffEq", "DiffEqCallbacks", "Distances", "Distributed", "DistributionsAD", "ExplicitImports", "ForwardDiff", "Flux", "Hwloc", "InteractiveUtils", "LuxCUDA", "MLDatasets", "NNlib", "OneHotArrays", "Optimisers", "Optimization", "OptimizationOptimJL", "OptimizationOptimisers", "OrdinaryDiffEq", "Printf", "Random", "ReTestItems", "Reexport", "Statistics", "StochasticDiffEq", "Test", "Zygote"]
test = ["Aqua", "BenchmarkTools", "ComponentArrays", "DataInterpolations", "DelayDiffEq", "DiffEqCallbacks", "Distances", "Distributed", "DistributionsAD", "ExplicitImports", "ForwardDiff", "Flux", "Hwloc", "InteractiveUtils", "LuxCUDA", "NNlib", "OneHotArrays", "Optimisers", "Optimization", "OptimizationOptimJL", "OptimizationOptimisers", "OrdinaryDiffEq", "Printf", "Random", "ReTestItems", "Reexport", "Statistics", "StochasticDiffEq", "Test", "Zygote"]
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,18 @@ explore various ways to integrate the two methodologies:

## Breaking Changes

### v4 (upcoming)
### v4

- `TensorLayer` has been removed, use `Boltz.Layers.TensorProductLayer` instead.
- Basis functions in DiffEqFlux have been removed in favor of `Boltz.Basis` module.
- `SplineLayer` has been removed, use `Boltz.Layers.SplineLayer` instead.
- `NeuralHamiltonianDE` has been removed, use `NeuralODE` with `Layers.HamiltonianNN` instead.
- `HamiltonianNN` has been removed in favor of `Layers.HamiltonianNN`.
- `Lux` and `Boltz` are updated to v1.

### v3

- Flux dependency is dropped. If a non Lux `AbstractExplicitLayer` is passed we try to automatically convert it to a Lux model with `FromFluxAdaptor()(model)`.
- Flux dependency is dropped. If a non Lux `AbstractLuxLayer` is passed we try to automatically convert it to a Lux model with `FromFluxAdaptor()(model)`.
- `Flux` is no longer re-exported from `DiffEqFlux`. Instead we reexport `Lux`.
- `NeuralDAE` now allows an optional `du0` as input.
- `TensorLayer` is now a Lux Neural Network.
Expand Down
6 changes: 3 additions & 3 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ CUDA = "5"
ComponentArrays = "0.15"
DataDeps = "0.7"
DataFrames = "1"
DiffEqFlux = "3"
DiffEqFlux = "4"
Distances = "0.10.7"
Distributions = "0.25.78"
Documenter = "1"
Flux = "0.14"
ForwardDiff = "0.10"
IterTools = "1"
LinearAlgebra = "1"
Lux = "0.5.5"
Lux = "1"
LuxCUDA = "0.3"
MLDatasets = "0.7"
MLDatasets = "0.7.18"
MLUtils = "0.4"
NNlib = "0.9"
OneHotArrays = "0.2"
Expand Down
13 changes: 7 additions & 6 deletions docs/src/examples/hamiltonian_nn.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dataloader = ncycle(
for i in 1:(size(data, 2) ÷ B)),
NEPOCHS)
hnn = HamiltonianNN(Chain(Dense(2 => 64, relu), Dense(64 => 1)); ad = AutoZygote())
hnn = Layers.HamiltonianNN{true}(Layers.MLP(2, (64, 1)); autodiff = AutoZygote())
ps, st = Lux.setup(Xoshiro(0), hnn)
ps_c = ps |> ComponentArray
Expand All @@ -57,7 +57,7 @@ res = Optimization.solve(opt_prob, opt, dataloader; callback)
ps_trained = res.u
model = NeuralHamiltonianDE(
model = NeuralODE(
hnn, (0.0f0, 1.0f0), Tsit5(); save_everystep = false, save_start = true, saveat = t)
pred = Array(first(model(data[:, 1], ps_trained, st)))
Expand Down Expand Up @@ -97,10 +97,10 @@ dataloader = ncycle(

### Training the HamiltonianNN

We parameterize the HamiltonianNN with a small MultiLayered Perceptron. HNNs are trained by optimizing the gradients of the Neural Network. Zygote currently doesn't support nesting itself, so we will be using ForwardDiff in the training loop to compute the gradients of the HNN Layer for Optimization.
We parameterize the with a small MultiLayered Perceptron. HNNs are trained by optimizing the gradients of the Neural Network. Zygote currently doesn't support nesting itself, so we will be using ForwardDiff in the training loop to compute the gradients of the HNN Layer for Optimization.

```@example hamiltonian
hnn = HamiltonianNN(Chain(Dense(2 => 64, relu), Dense(64 => 1)); ad = AutoZygote())
hnn = Layers.HamiltonianNN{true}(Layers.MLP(2, (64, 1)); autodiff = AutoZygote())
ps, st = Lux.setup(Xoshiro(0), hnn)
ps_c = ps |> ComponentArray
Expand All @@ -127,10 +127,11 @@ ps_trained = res.u

### Solving the ODE using trained HNN

In order to visualize the learned trajectories, we need to solve the ODE. We will use the `NeuralHamiltonianDE` layer, which is essentially a wrapper over `HamiltonianNN` layer, and solves the ODE.
In order to visualize the learned trajectories, we need to solve the ODE. We will use the
`NeuralODE` layer with `HamiltonianNN` layer, and solves the ODE.

```@example hamiltonian
model = NeuralHamiltonianDE(
model = NeuralODE(
hnn, (0.0f0, 1.0f0), Tsit5(); save_everystep = false, save_start = true, saveat = t)
pred = Array(first(model(data[:, 1], ps_trained, st)))
Expand Down
10 changes: 5 additions & 5 deletions docs/src/examples/neural_gde.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using GraphNeuralNetworks, DifferentialEquations
using DiffEqFlux: NeuralODE
using GraphNeuralNetworks.GNNGraphs: normalized_adjacency
using Lux, NNlib, Optimisers, Zygote, Random, ComponentArrays
using Lux: AbstractExplicitLayer, glorot_normal, zeros32
using Lux: AbstractLuxLayer, glorot_normal, zeros32
import Lux: initialparameters, initialstates
using SciMLSensitivity
using Statistics: mean
Expand Down Expand Up @@ -46,7 +46,7 @@ nout = length(classes)
epochs = 20

# Define the graph neural network
struct ExplicitGCNConv{F1, F2, F3, F4} <: AbstractExplicitLayer
struct ExplicitGCNConv{F1, F2, F3, F4} <: AbstractLuxLayer
in_chs::Int
out_chs::Int
activation::F1
Expand Down Expand Up @@ -152,7 +152,7 @@ using GraphNeuralNetworks, DifferentialEquations
using DiffEqFlux: NeuralODE
using GraphNeuralNetworks.GNNGraphs: normalized_adjacency
using Lux, NNlib, Optimisers, Zygote, Random, ComponentArrays
using Lux: AbstractExplicitLayer, glorot_normal, zeros32
using Lux: AbstractLuxLayer, glorot_normal, zeros32
import Lux: initialparameters, initialstates
using SciMLSensitivity
using Statistics: mean
Expand Down Expand Up @@ -207,10 +207,10 @@ epochs = 20

## Define the Graph Neural Network

Here, we define a type of graph neural networks called `GCNConv`. We use the name `ExplicitGCNConv` to avoid naming conflicts with `GraphNeuralNetworks`. For more information on defining a layer with `Lux`, please consult to the [doc](http://lux.csail.mit.edu/dev/introduction/overview/#AbstractExplicitLayer-API).
Here, we define a type of graph neural networks called `GCNConv`. We use the name `ExplicitGCNConv` to avoid naming conflicts with `GraphNeuralNetworks`. For more information on defining a layer with `Lux`, please consult to the [doc](http://lux.csail.mit.edu/dev/introduction/overview/#AbstractLuxLayer-API).

```julia
struct ExplicitGCNConv{F1, F2, F3} <: AbstractExplicitLayer
struct ExplicitGCNConv{F1, F2, F3} <: AbstractLuxLayer
::AbstractMatrix # nomalized_adjacency matrix
in_chs::Int
out_chs::Int
Expand Down
4 changes: 2 additions & 2 deletions docs/src/examples/tensor_layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ Now, we create a TensorLayer that will be able to perform 10th order expansions
a Legendre Basis:

```@example tensor
A = [LegendreBasis(10), LegendreBasis(10)]
nn = TensorLayer(A, 1)
A = [Basis.Legendre(10), Basis.Legendre(10)]
nn = Layers.TensorProductLayer(A, 1)
ps, st = Lux.setup(Xoshiro(0), nn)
ps = ComponentArray(ps)
nn = StatefulLuxLayer{true}(nn, nothing, st)
Expand Down
8 changes: 4 additions & 4 deletions src/DiffEqFlux.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using ConcreteStructs: @concrete
using Distributions: Distributions, ContinuousMultivariateDistribution, Distribution, logpdf
using LinearAlgebra: LinearAlgebra, Diagonal, det, tr, mul!
using Lux: Lux, Chain, Dense, StatefulLuxLayer, FromFluxAdaptor
using LuxCore: LuxCore, AbstractExplicitLayer, AbstractExplicitContainerLayer
using LuxCore: LuxCore, AbstractLuxLayer, AbstractLuxContainerLayer, AbstractLuxWrapperLayer
using LuxLib: batched_matmul
using Random: Random, AbstractRNG, randn!
using Reexport: @reexport
Expand All @@ -20,22 +20,22 @@ using SciMLSensitivity: SciMLSensitivity, AdjointLSS, BacksolveAdjoint, EnzymeVJ
SteadyStateAdjoint, TrackerAdjoint, TrackerVJP, ZygoteAdjoint,
ZygoteVJP
using Setfield: @set!
using Static: True, False

const CRC = ChainRulesCore

@reexport using ADTypes, Lux, Boltz

fixed_state_type(_) = true
fixed_state_type(::Layers.HamiltonianNN{FST}) where {FST} = FST
fixed_state_type(::Layers.HamiltonianNN{True}) = true
fixed_state_type(::Layers.HamiltonianNN{False}) = false

include("ffjord.jl")
include("neural_de.jl")

include("collocation.jl")
include("multiple_shooting.jl")

include("deprecated.jl")

export NeuralODE, NeuralDSDE, NeuralSDE, NeuralCDDE, NeuralDAE, AugmentedNDELayer,
NeuralODEMM
export FFJORD, FFJORDDistribution
Expand Down
47 changes: 0 additions & 47 deletions src/deprecated.jl

This file was deleted.

8 changes: 4 additions & 4 deletions src/ffjord.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
abstract type CNFLayer <: LuxCore.AbstractExplicitContainerLayer{(:model,)} end
abstract type CNFLayer <: AbstractLuxWrapperLayer{:model} end

"""
FFJORD(model, tspan, input_dims, args...; ad = nothing, basedist = nothing, kwargs...)
Expand All @@ -21,7 +21,7 @@ for new values of x.
Arguments:
- `model`: A `Flux.Chain` or `Lux.AbstractExplicitLayer` neural network that defines the
- `model`: A `Flux.Chain` or `Lux.AbstractLuxLayer` neural network that defines the
dynamics of the model.
- `basedist`: Distribution of the base variable. Set to the unit normal by default.
- `input_dims`: Input Dimensions of the model.
Expand Down Expand Up @@ -49,7 +49,7 @@ Information Processing Systems, pp. 6572-6583. 2018.
preprint arXiv:1810.01367 (2018).
"""
@concrete struct FFJORD <: CNFLayer
model <: AbstractExplicitLayer
model <: AbstractLuxLayer
basedist <: Union{Nothing, Distribution}
ad
input_dims
Expand All @@ -65,7 +65,7 @@ end

function FFJORD(
model, tspan, input_dims, args...; ad = nothing, basedist = nothing, kwargs...)
!(model isa AbstractExplicitLayer) && (model = FromFluxAdaptor()(model))
!(model isa AbstractLuxLayer) && (model = FromFluxAdaptor()(model))
return FFJORD(model, basedist, ad, input_dims, tspan, args, kwargs)
end

Expand Down
Loading

2 comments on commit f1843f3

@avik-pal
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/115380

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v4.0.0 -m "<description of version>" f1843f379b70d2ae0a1aa13eda3afeebc7e9ea78
git push origin v4.0.0

Please sign in to comment.