From 9fb7cc48f8349c712820e80cbc5cb2283249c9b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Miclu=C8=9Ba-C=C3=A2mpeanu?= Date: Sun, 7 Apr 2024 02:57:34 +0300 Subject: [PATCH 1/7] refactor: add `disable_optimizations` as kwarg --- src/utils.jl | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/src/utils.jl b/src/utils.jl index 58f59e2..ef45898 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -1,25 +1,6 @@ function multi_layer_feed_forward(input_length, output_length; width::Int = 5, - depth::Int = 1, activation = softplus) + depth::Int = 1, activation = softplus, disable_optimizations = false) Lux.Chain(Lux.Dense(input_length, width, activation), [Lux.Dense(width, width, activation) for _ in 1:(depth)]..., - Lux.Dense(width, output_length); disable_optimizations = true) + Lux.Dense(width, output_length); disable_optimizations) end - -# Symbolics.@register_array_symbolic print_input(x) begin -# size = size(x) -# eltype = eltype(x) -# end - -# function print_input(x) -# @info x -# x -# end - -# function debug_component(n_input, n_output) -# @named input = RealInput(nin = n_input) -# @named output = RealOutput(nout = n_output) - -# eqs = [output.u ~ print_input(input.u)] - -# @named dbg_comp = ODESystem(eqs, t_nounits, [], [], systems = [input, output]) -# end From 1458552f960473355775f31ca6ea15ab26eddcb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Miclu=C8=9Ba-C=C3=A2mpeanu?= Date: Sun, 7 Apr 2024 02:59:01 +0300 Subject: [PATCH 2/7] style: fix formatting --- src/UDEComponents.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/UDEComponents.jl b/src/UDEComponents.jl index 99347fd..92b4286 100644 --- a/src/UDEComponents.jl +++ b/src/UDEComponents.jl @@ -15,7 +15,6 @@ include("utils.jl") include("hacks.jl") # this should be removed / upstreamed """ - create_ude_component(n_input = 1, n_output = 1; chain = multi_layer_feed_forward(n_input, n_output), rng = Xoshiro(0)) From d8642d5ba487ccd19b95436f31a3ccb867dddce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Miclu=C8=9Ba-C=C3=A2mpeanu?= Date: Sun, 7 Apr 2024 02:59:21 +0300 Subject: [PATCH 3/7] test: comment out callback --- test/lotka_volterra.jl | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/test/lotka_volterra.jl b/test/lotka_volterra.jl index 154f56e..14f4a28 100644 --- a/test/lotka_volterra.jl +++ b/test/lotka_volterra.jl @@ -83,7 +83,6 @@ function loss(x, (prob, sol_ref, get_vars, get_refs)) end end - of = OptimizationFunction{true}(loss, AutoForwardDiff()) ps = (prob, sol_ref, get_vars, get_refs); @@ -100,15 +99,15 @@ op = OptimizationProblem(of, x0, (prob, sol_ref, get_vars, get_refs)) # oh = [] -plot_cb = (opt_state, loss) -> begin - @info "step $(opt_state.iter), loss: $loss" - # push!(oh, opt_state) - # new_p = SciMLStructures.replace(Tunable(), prob.p, opt_state.u) - # new_prob = remake(prob, p = new_p) - # sol = solve(new_prob, Rodas4()) - # display(plot(sol)) - false -end +# plot_cb = (opt_state, loss) -> begin +# @info "step $(opt_state.iter), loss: $loss" +# push!(oh, opt_state) +# new_p = SciMLStructures.replace(Tunable(), prob.p, opt_state.u) +# new_prob = remake(prob, p = new_p) +# sol = solve(new_prob, Rodas4()) +# display(plot(sol)) +# false +# end res = solve(op, Adam(), maxiters = 2000)#, callback = plot_cb) From 3bdcfc045e88f462ea2988c33aa4cd54ecda13d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Miclu=C8=9Ba-C=C3=A2mpeanu?= Date: Sun, 7 Apr 2024 03:00:14 +0300 Subject: [PATCH 4/7] chore: fix urls for badges --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 971a1bb..09c12e5 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # UDEComponents -[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://SebastianM-C.github.io/UDEComponents.jl/stable/) -[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://SebastianM-C.github.io/UDEComponents.jl/dev/) -[![Build Status](https://github.com/SebastianM-C/UDEComponents.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/SebastianM-C/UDEComponents.jl/actions/workflows/CI.yml?query=branch%3Amain) -[![Coverage](https://codecov.io/gh/SebastianM-C/UDEComponents.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/SebastianM-C/UDEComponents.jl) +[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://SciML.github.io/UDEComponents.jl/stable/) +[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://SciML.github.io/UDEComponents.jl/dev/) +[![Build Status](https://github.com/SciML/UDEComponents.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/SciML/UDEComponents.jl/actions/workflows/CI.yml?query=branch%3Amain) +[![Coverage](https://codecov.io/gh/SciML/UDEComponents.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/SciML/UDEComponents.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) [![Aqua](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl) From 2b21380f692079aed7d282bbf354aa162747fa88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Miclu=C8=9Ba-C=C3=A2mpeanu?= Date: Sun, 7 Apr 2024 03:03:31 +0300 Subject: [PATCH 5/7] ci: add typo exceptions --- .typos.toml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .typos.toml diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 0000000..4b87229 --- /dev/null +++ b/.typos.toml @@ -0,0 +1,2 @@ +[default.extend-words] +nin = "nin" From 5b66ca3ed9455ebec218340d0b534535e132d68c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Miclu=C8=9Ba-C=C3=A2mpeanu?= Date: Sun, 7 Apr 2024 03:07:05 +0300 Subject: [PATCH 6/7] docs: fix urls --- docs/make.jl | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 87fb033..94b04b1 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,23 +1,23 @@ using UDEComponents using Documenter -DocMeta.setdocmeta!(UDEComponents, :DocTestSetup, :(using UDEComponents); recursive=true) +DocMeta.setdocmeta!(UDEComponents, :DocTestSetup, :(using UDEComponents); recursive = true) makedocs(; - modules=[UDEComponents], - authors="Sebastian Micluța-Câmpeanu and contributors", - sitename="UDEComponents.jl", - format=Documenter.HTML(; - canonical="https://SebastianM-C.github.io/UDEComponents.jl", - edit_link="main", - assets=String[], + modules = [UDEComponents], + authors = "Sebastian Micluța-Câmpeanu and contributors", + sitename = "UDEComponents.jl", + format = Documenter.HTML(; + canonical = "https://SciML.github.io/UDEComponents.jl", + edit_link = "main", + assets = String[] ), - pages=[ - "Home" => "index.md", - ], + pages = [ + "Home" => "index.md" + ] ) deploydocs(; - repo="github.com/SebastianM-C/UDEComponents.jl", - devbranch="main", + repo = "github.com/SciML/UDEComponents.jl", + devbranch = "main" ) From e76c4b5a027462ee4bbfe2c71b5e0670be42e85c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Miclu=C8=9Ba-C=C3=A2mpeanu?= Date: Sun, 7 Apr 2024 03:07:22 +0300 Subject: [PATCH 7/7] style: fix formatting --- test/lotka_volterra.jl | 7 ++----- test/qa.jl | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/test/lotka_volterra.jl b/test/lotka_volterra.jl index 14f4a28..1f35c8c 100644 --- a/test/lotka_volterra.jl +++ b/test/lotka_volterra.jl @@ -43,10 +43,8 @@ end model = lotka_ude() nn = create_ude_component(2, 2) -eqs = [ - connect(model.nn_in, nn.output) - connect(model.nn_out, nn.input) -] +eqs = [connect(model.nn_in, nn.output) + connect(model.nn_out, nn.input)] ude_sys = complete(ODESystem( eqs, ModelingToolkit.t_nounits, systems = [model, nn], name = :ude_sys)) @@ -94,7 +92,6 @@ ps = (prob, sol_ref, get_vars, get_refs); op = OptimizationProblem(of, x0, (prob, sol_ref, get_vars, get_refs)) - # using Plots # oh = [] diff --git a/test/qa.jl b/test/qa.jl index 002f0bd..b25881e 100644 --- a/test/qa.jl +++ b/test/qa.jl @@ -3,12 +3,12 @@ using UDEComponents using Aqua using JET -@testset verbose = true "Code quality (Aqua.jl)" begin +@testset verbose=true "Code quality (Aqua.jl)" begin Aqua.find_persistent_tasks_deps(UDEComponents) Aqua.test_ambiguities(UDEComponents, recursive = false) Aqua.test_deps_compat(UDEComponents) # TODO: fix type piracy in propagate_ndims and propagate_shape - Aqua.test_piracies(UDEComponents, broken=true) + Aqua.test_piracies(UDEComponents, broken = true) Aqua.test_project_extras(UDEComponents) Aqua.test_stale_deps(UDEComponents, ignore = Symbol[]) Aqua.test_unbound_args(UDEComponents)