diff --git a/Project.toml b/Project.toml index af96777..61701be 100644 --- a/Project.toml +++ b/Project.toml @@ -17,4 +17,5 @@ Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" [compat] -DynamicPPL = "0.36" +DynamicPPL = "0.37" +Turing = "0.40" diff --git a/main.jl b/main.jl index 51219a1..30762fd 100644 --- a/main.jl +++ b/main.jl @@ -1,5 +1,5 @@ using DynamicPPL: DynamicPPL, VarInfo -using DynamicPPL.TestUtils.AD: run_ad, ADResult, ADIncorrectException +using DynamicPPL.TestUtils.AD: run_ad, ADResult, ADIncorrectException, WithBackend using ADTypes using Random: Xoshiro @@ -12,13 +12,14 @@ import Zygote # AD backends to test. ADTYPES = Dict( - "FiniteDifferences" => AutoFiniteDifferences(; fdm = central_fdm(5, 1)), + "FiniteDifferences" => AutoFiniteDifferences(; fdm=central_fdm(5, 1)), "ForwardDiff" => AutoForwardDiff(), - "ReverseDiff" => AutoReverseDiff(; compile = false), - "ReverseDiffCompiled" => AutoReverseDiff(; compile = true), - "Mooncake" => AutoMooncake(; config = nothing), - "EnzymeForward" => AutoEnzyme(; mode = set_runtime_activity(Forward, true)), - "EnzymeReverse" => AutoEnzyme(; mode = set_runtime_activity(Reverse, true)), + "ReverseDiff" => AutoReverseDiff(; compile=false), + "ReverseDiffCompiled" => AutoReverseDiff(; compile=true), + "MooncakeReverse" => AutoMooncake(), + "MooncakeForward" => AutoMooncakeForward(), + "EnzymeForward" => AutoEnzyme(; mode=set_runtime_activity(Forward, true)), + "EnzymeReverse" => AutoEnzyme(; mode=set_runtime_activity(Reverse, true)), "Zygote" => AutoZygote(), ) @@ -132,21 +133,18 @@ elseif length(ARGS) == 3 && ARGS[1] == "--run" # https://github.com/TuringLang/ADTests/issues/4 vi = DynamicPPL.unflatten(VarInfo(model), [0.5, -0.5]) params = [-0.5, 0.5] - result = run_ad(model, adtype; varinfo = vi, params = params, benchmark = true) + result = run_ad(model, adtype; varinfo=vi, params=params, test=WithBackend(ADTYPES["FiniteDifferences"]), benchmark=true) else - vi = VarInfo(Xoshiro(468), model) - linked_vi = DynamicPPL.link!!(vi, model) - params = linked_vi[:] result = run_ad( model, adtype; - params = params, - reference_adtype = ADTYPES["FiniteDifferences"], - benchmark = true, + rng=Xoshiro(468), + test=WithBackend(ADTYPES["FiniteDifferences"]), + benchmark=true, ) end # If reached here - nothing went wrong - println(result.time_vs_primal) + println(result.grad_time / result.primal_time) catch e @show e if e isa ADIncorrectException diff --git a/web/src/App.svelte b/web/src/App.svelte index 5e3a200..06f84bf 100644 --- a/web/src/App.svelte +++ b/web/src/App.svelte @@ -102,6 +102,17 @@ >Download the raw data (JSON)

+ +

+ Note about Enzyme: Enzyme does not work with DynamicPPL 0.37 + / Turing 0.40 because of + this issue. If you want to use Enzyme with Turing, please use an older + version of Turing / DynamicPPL. +

+ {#each categorisedData.entries() as [category, modelData]}

{category}