Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Tests and Cleanup #873

Merged
merged 30 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bfb93ee
Start the purge
avik-pal Nov 9, 2023
2f709cb
Cleanup Tensor Product Layer and a Few Other NeuralDE Layers
avik-pal Nov 9, 2023
383b8bd
More stuff has been fixed
avik-pal Nov 9, 2023
7dd889d
Stiff Nested AD Tests
avik-pal Nov 9, 2023
8671a2d
Test if GPU works
avik-pal Nov 9, 2023
8e4cd87
Add statistics
avik-pal Nov 10, 2023
4857b76
Fix hamiltonian Neural DE
avik-pal Nov 10, 2023
323aee1
Fix GPU tests
avik-pal Nov 10, 2023
3c4fcb3
Some progress on FFJORD
avik-pal Nov 10, 2023
e521e2c
All but tracker is functional for FFJORD
avik-pal Nov 13, 2023
1fe3999
Backward FFJORD
avik-pal Nov 13, 2023
5e3c86b
Fix other tests
avik-pal Nov 14, 2023
9c62938
Mark Tracker as broken for CNF
avik-pal Nov 14, 2023
cf55104
Add aqua
avik-pal Nov 14, 2023
28f1644
Fix Aqua tests
avik-pal Nov 15, 2023
f262a29
Update some docs
avik-pal Nov 15, 2023
1f43cb9
More things functional
avik-pal Nov 15, 2023
29ccaf7
Fix MNIST CONV GPU test
avik-pal Nov 16, 2023
3a1ffba
Fix remaining docs
avik-pal Nov 16, 2023
2bedaab
Remove old Lux
avik-pal Nov 16, 2023
41c36a3
Bump docs compat
avik-pal Nov 16, 2023
531132a
Update compats
avik-pal Nov 17, 2023
d716475
Missing CA
avik-pal Nov 17, 2023
5c8a52e
Fix Hamiltonian NN docs
avik-pal Nov 20, 2023
b59a625
Flip ordering
avik-pal Nov 20, 2023
1d79acf
reduce maxiters
avik-pal Nov 20, 2023
13e4b83
Minor fixes
avik-pal Nov 21, 2023
299ca49
Fix FFJORD Example
avik-pal Nov 21, 2023
70bb64a
Update normalizing_flows.md
avik-pal Nov 22, 2023
526a256
Update test/neural_ode_mm.jl
ChrisRackauckas Nov 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
style = "sciml"
format_markdown = true
annotate_untyped_fields_with_any = false
format_markdown = true
separate_kwargs_with_semicolon = true
1 change: 1 addition & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ steps:
using Pkg
Pkg.instantiate()
Pkg.activate("docs")
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()
push!(LOAD_PATH, @__DIR__)
println("+++ :julia: Building documentation")
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ jobs:
- BasicNeuralDE
- AdvancedNeuralDE
- Newton
- Aqua
version:
- 1
- '1'
- '~1.10.0-0'
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
Expand Down
30 changes: 15 additions & 15 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
name = "DiffEqFlux"
uuid = "aae7a2af-3d4f-5e19-a356-7da93b79d9d0"
authors = ["Chris Rackauckas <[email protected]>"]
version = "2.5.1"
version = "3.0.0"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
ConsoleProgressMonitor = "88cd18e8-d9cc-4ea6-8889-5259c0d15c8b"
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
ConcreteStructs = "2569d6c7-a4a2-43d3-a901-331e8e4be471"
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
DistributionsAD = "ced4e74d-a319-5a8a-b0ac-84af2272839c"
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Functors = "d9f16b24-f501-4c13-a1f2-28368ffc5196"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36"
Lux = "b2108857-7c20-44ae-9111-449ecde12c47"
LuxCore = "bb33d45b-7691-41d6-9220-0943567d0623"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
ProgressLogging = "33c8b6b6-d38a-422a-b730-caa89a2f386c"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SciMLSensitivity = "1ed8b502-d754-442c-8d5d-10ac956f44a1"
TerminalLoggers = "5d786b92-1e48-4d6f-9151-6b4477ca9bed"
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444"

[compat]
ADTypes = "0.2"
Adapt = "3"
ChainRulesCore = "1"
ConsoleProgressMonitor = "0.1"
DataInterpolations = "3.3, 4"
ComponentArrays = "0.15.5"
ConcreteStructs = "0.2"
DiffEqBase = "6.41"
Distributions = "0.23, 0.24, 0.25"
DistributionsAD = "0.6"
Flux = "0.14"
ForwardDiff = "0.10"
Functors = "0.4"
LoggingExtras = "0.4, 1"
LinearAlgebra = "<0.0.1, 1"
Lux = "0.5.5"
LuxCore = "0.1"
ProgressLogging = "0.1"
PrecompileTools = "1"
Random = "<0.0.1, 1"
RecursiveArrayTools = "2"
Reexport = "0.2, 1"
SciMLBase = "1, 2"
SciMLSensitivity = "7"
TerminalLoggers = "0.1"
Tracker = "0.2.29"
Zygote = "0.5, 0.6"
ZygoteRules = "0.2"
julia = "1.9"
44 changes: 26 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
[![Build Status](https://github.com/SciML/DiffEqFlux.jl/workflows/CI/badge.svg)](https://github.com/SciML/DiffEqFlux.jl/actions?query=workflow%3ACI)
[![Build status](https://badge.buildkite.com/a1fecf87b085b452fe0f3d3968ddacb5c1d5570806834e1d52.svg)](https://buildkite.com/julialang/diffeqflux-dot-jl)

[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac)
[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor%27s%20Guide-blueviolet)](https://github.com/SciML/ColPrac)
[![SciML Code Style](https://img.shields.io/static/v1?label=code%20style&message=SciML&color=9558b2&labelColor=389826)](https://github.com/SciML/SciMLStyle)

DiffEqFlux.jl fuses the world of differential equations with machine learning
DiffEq(For)Lux.jl (aka DiffEqFlux.jl) fuses the world of differential equations with machine learning
by helping users put diffeq solvers into neural networks. This package utilizes
[DifferentialEquations.jl](https://docs.sciml.ai/DiffEqDocs/stable/),
[Flux.jl](https://docs.sciml.ai/Flux/stable/) and [Lux.jl](https://lux.csail.mit.edu/v0.5.5/api/) as its building blocks to support research in
[Scientific Machine Learning](https://www.stochasticlifestyle.com/the-essential-tools-of-scientific-machine-learning-scientific-ml/),
specifically neural differential equations and universal differential equations,
to add physical information into traditional machine learning.
[DifferentialEquations.jl](https://docs.sciml.ai/DiffEqDocs/stable/), and [Lux.jl](https://lux.csail.mit.edu/) as its building blocks to support research in
[Scientific Machine Learning](https://www.stochasticlifestyle.com/the-essential-tools-of-scientific-machine-learning-scientific-ml/), specifically neural differential equations and universal differential equations, to add physical information into traditional machine learning.

> [!NOTE]
> We maintain backwards compatibility with [Flux.jl](https://docs.sciml.ai/Flux/stable/) via [Lux.transform](https://lux.csail.mit.edu/stable/api/Lux/flux_to_lux#Lux.transform)

## Tutorials and Documentation

Expand All @@ -40,12 +40,12 @@ Scientific Machine Learning](https://arxiv.org/abs/2001.04385).

As such, it is the first package to support and demonstrate:

- Stiff and non-stiff universal ordinary differential equations (universal ODEs)
- Universal stochastic differential equations (universal SDEs)
- Universal delay differential equations (universal DDEs)
- Universal partial differential equations (universal PDEs)
- Universal jump stochastic differential equations (universal jump diffusions)
- Hybrid universal differential equations (universal DEs with event handling)
- Stiff and non-stiff universal ordinary differential equations (universal ODEs)
- Universal stochastic differential equations (universal SDEs)
- Universal delay differential equations (universal DDEs)
- Universal partial differential equations (universal PDEs)
- Universal jump stochastic differential equations (universal jump diffusions)
- Hybrid universal differential equations (universal DEs with event handling)

with high order, adaptive, implicit, GPU-accelerated, Newton-Krylov, etc.
methods. For examples, please refer to
Expand All @@ -58,10 +58,18 @@ PDEs and neural jump SDEs, can be found
Do not limit yourself to the current neuralization. With this package, you can
explore various ways to integrate the two methodologies:

- Neural networks can be defined where the “activations” are nonlinear functions
described by differential equations
- Neural networks can be defined where some layers are ODE solves
- ODEs can be defined where some terms are neural networks
- Cost functions on ODEs can define neural networks
- Neural networks can be defined where the “activations” are nonlinear functions
described by differential equations
- Neural networks can be defined where some layers are ODE solves
- ODEs can be defined where some terms are neural networks
- Cost functions on ODEs can define neural networks

![Flux ODE Training Animation](https://user-images.githubusercontent.com/1814174/88589293-e8207f80-d026-11ea-86e2-8a3feb8252ca.gif)

## Breaking Changes in v3

- Flux dependency is dropped. If a non Lux `AbstractExplicitLayer` is passed we try to automatically convert it to a Lux model with `Lux.transform(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.
- APIs for quite a few layer constructions have changed. Please refer to the updated documentation for more details.
20 changes: 16 additions & 4 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
DataDeps = "124859b0-ceae-595e-8997-d05f6a7a8dfe"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DiffEqFlux = "aae7a2af-3d4f-5e19-a356-7da93b79d9d0"
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Expand All @@ -13,49 +13,61 @@ ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Lux = "b2108857-7c20-44ae-9111-449ecde12c47"
LuxCUDA = "d0bbae9a-e099-4d5b-a835-1c6931763bda"
MLDataUtils = "cc2ba9b6-d476-5e6d-8eaf-a92d5412d41d"
MLDatasets = "eb30cadb-4394-5ae3-aed4-317e484a6458"
MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54"
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
Optimisers = "3bd65402-5787-11e9-1adc-39752487f4e2"
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
OptimizationOptimJL = "36348300-93cb-4f02-beb5-3c3902f8871e"
OptimizationOptimisers = "42dfb2eb-d2b4-4451-abcd-913932933ac1"
OptimizationPolyalgorithms = "500b13db-7e66-49ce-bda4-eed966be6282"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SciMLSensitivity = "1ed8b502-d754-442c-8d5d-10ac956f44a1"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StochasticDiffEq = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[compat]
CSV = "0.10"
ComponentArrays = "0.13, 0.14, 0.15"
DataDeps = "0.7"
DataFrames = "1"
DiffEqFlux = "2"
DifferentialEquations = "7.6.0"
DiffEqFlux = "3"
Distances = "0.10.7"
Distributions = "0.25.78"
Documenter = "1"
Flux = "0.14"
ForwardDiff = "0.10"
IterTools = "1"
Lux = "0.4.34, 0.5"
LinearAlgebra = "<0.0.1, 1"
Lux = "0.5.5"
LuxCUDA = "0.3"
MLDataUtils = "0.5"
MLDatasets = "0.7"
MLUtils = "0.4"
NNlib = "0.9"
Optimisers = "0.2, 0.3"
Optimization = "3.9"
OptimizationOptimJL = "0.1"
OptimizationOptimisers = "0.1"
OptimizationPolyalgorithms = "0.1"
OrdinaryDiffEq = "6.31"
Plots = "1.36"
Printf = "<0.0.1, 1"
Random = "<0.0.1, 1"
ReverseDiff = "1.14"
SciMLBase = "1.72, 2"
SciMLSensitivity = "7.11"
Statistics = "1"
StochasticDiffEq = "6.56"
Test = "<0.0.1, 1"
Zygote = "0.6.62"
22 changes: 9 additions & 13 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
using Documenter, DiffEqFlux

cp("./docs/Manifest.toml", "./docs/src/assets/Manifest.toml", force = true)
cp("./docs/Project.toml", "./docs/src/assets/Project.toml", force = true)
cp("./docs/Manifest.toml", "./docs/src/assets/Manifest.toml"; force = true)
cp("./docs/Project.toml", "./docs/src/assets/Project.toml"; force = true)

ENV["GKSwstype"] = "100"
using Plots
ENV["DATADEPS_ALWAYS_ACCEPT"] = true

include("pages.jl")

makedocs(
sitename = "DiffEqFlux.jl",
authors="Chris Rackauckas et al.",
makedocs(; sitename = "DiffEqFlux.jl",
authors = "Chris Rackauckas et al.",
clean = true, doctest = false, linkcheck = true,
warnonly = [:docs_block, :missing_docs],
modules = [DiffEqFlux],
format = Documenter.HTML(assets = ["assets/favicon.ico"],
canonical="https://docs.sciml.ai/DiffEqFlux/stable/"),
pages=pages
)
format = Documenter.HTML(; assets = ["assets/favicon.ico"],
canonical = "https://docs.sciml.ai/DiffEqFlux/stable/"),
pages = pages)

deploydocs(
repo = "github.com/SciML/DiffEqFlux.jl.git";
push_preview = true
)
deploydocs(; repo = "github.com/SciML/DiffEqFlux.jl.git",
push_preview = true)
50 changes: 22 additions & 28 deletions docs/pages.jl
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
pages = [
"DiffEqFlux.jl: High Level Scientific Machine Learning (SciML) Pre-Built Architectures" => "index.md",
"Differential Equation Machine Learning Tutorials" => Any[
"examples/neural_ode.md",
"examples/GPUs.md",
"examples/mnist_neural_ode.md",
"examples/mnist_conv_neural_ode.md",
"examples/augmented_neural_ode.md",
"examples/neural_sde.md",
"examples/collocation.md",
"examples/normalizing_flows.md",
"examples/hamiltonian_nn.md",
"examples/tensor_layer.md",
"examples/multiple_shooting.md",
"examples//neural_ode_weather_forecast.md"
],
"Layer APIs" => Any[
"Classical Basis Layers" => "layers/BasisLayers.md",
"Tensor Product Layer" => "layers/TensorLayer.md",
"Continuous Normalizing Flows Layer" => "layers/CNFLayer.md",
"Spline Layer" => "layers/SplineLayer.md",
"Neural Differential Equation Layers" => "layers/NeuralDELayers.md",
"Hamiltonian Neural Network Layer" => "layers/HamiltonianNN.md"
],
"Utility Function APIs" => Any[
"Smoothed Collocation" => "utilities/Collocation.md",
"Multiple Shooting Functionality" => "utilities/MultipleShooting.md",
],
]
"DiffEqFlux.jl: High Level Scientific Machine Learning (SciML) Pre-Built Architectures" => "index.md",
"Differential Equation Machine Learning Tutorials" => Any["examples/neural_ode.md",
"examples/GPUs.md",
"examples/mnist_neural_ode.md",
"examples/mnist_conv_neural_ode.md",
"examples/augmented_neural_ode.md",
"examples/neural_sde.md",
"examples/collocation.md",
"examples/normalizing_flows.md",
"examples/hamiltonian_nn.md",
"examples/tensor_layer.md",
"examples/multiple_shooting.md",
"examples//neural_ode_weather_forecast.md"],
"Layer APIs" => Any["Classical Basis Layers" => "layers/BasisLayers.md",
"Tensor Product Layer" => "layers/TensorLayer.md",
"Continuous Normalizing Flows Layer" => "layers/CNFLayer.md",
"Spline Layer" => "layers/SplineLayer.md",
"Neural Differential Equation Layers" => "layers/NeuralDELayers.md",
"Hamiltonian Neural Network Layer" => "layers/HamiltonianNN.md"],
"Utility Function APIs" => Any["Smoothed Collocation" => "utilities/Collocation.md",
"Multiple Shooting Functionality" => "utilities/MultipleShooting.md"],
]
Loading