Skip to content

Commit 2bf0fb4

Browse files
authored
Merge pull request #38 from TuringLang/py/up
Bump versions and add Mooncake forward
2 parents c0896c2 + a532c27 commit 2bf0fb4

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
1717
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
1818

1919
[compat]
20-
DynamicPPL = "0.36"
20+
DynamicPPL = "0.37"
21+
Turing = "0.40"

main.jl

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using DynamicPPL: DynamicPPL, VarInfo
2-
using DynamicPPL.TestUtils.AD: run_ad, ADResult, ADIncorrectException
2+
using DynamicPPL.TestUtils.AD: run_ad, ADResult, ADIncorrectException, WithBackend
33
using ADTypes
44
using Random: Xoshiro
55

@@ -12,13 +12,14 @@ import Zygote
1212

1313
# AD backends to test.
1414
ADTYPES = Dict(
15-
"FiniteDifferences" => AutoFiniteDifferences(; fdm = central_fdm(5, 1)),
15+
"FiniteDifferences" => AutoFiniteDifferences(; fdm=central_fdm(5, 1)),
1616
"ForwardDiff" => AutoForwardDiff(),
17-
"ReverseDiff" => AutoReverseDiff(; compile = false),
18-
"ReverseDiffCompiled" => AutoReverseDiff(; compile = true),
19-
"Mooncake" => AutoMooncake(; config = nothing),
20-
"EnzymeForward" => AutoEnzyme(; mode = set_runtime_activity(Forward, true)),
21-
"EnzymeReverse" => AutoEnzyme(; mode = set_runtime_activity(Reverse, true)),
17+
"ReverseDiff" => AutoReverseDiff(; compile=false),
18+
"ReverseDiffCompiled" => AutoReverseDiff(; compile=true),
19+
"MooncakeReverse" => AutoMooncake(),
20+
"MooncakeForward" => AutoMooncakeForward(),
21+
"EnzymeForward" => AutoEnzyme(; mode=set_runtime_activity(Forward, true)),
22+
"EnzymeReverse" => AutoEnzyme(; mode=set_runtime_activity(Reverse, true)),
2223
"Zygote" => AutoZygote(),
2324
)
2425

@@ -132,21 +133,18 @@ elseif length(ARGS) == 3 && ARGS[1] == "--run"
132133
# https://github.com/TuringLang/ADTests/issues/4
133134
vi = DynamicPPL.unflatten(VarInfo(model), [0.5, -0.5])
134135
params = [-0.5, 0.5]
135-
result = run_ad(model, adtype; varinfo = vi, params = params, benchmark = true)
136+
result = run_ad(model, adtype; varinfo=vi, params=params, test=WithBackend(ADTYPES["FiniteDifferences"]), benchmark=true)
136137
else
137-
vi = VarInfo(Xoshiro(468), model)
138-
linked_vi = DynamicPPL.link!!(vi, model)
139-
params = linked_vi[:]
140138
result = run_ad(
141139
model,
142140
adtype;
143-
params = params,
144-
reference_adtype = ADTYPES["FiniteDifferences"],
145-
benchmark = true,
141+
rng=Xoshiro(468),
142+
test=WithBackend(ADTYPES["FiniteDifferences"]),
143+
benchmark=true,
146144
)
147145
end
148146
# If reached here - nothing went wrong
149-
println(result.time_vs_primal)
147+
println(result.grad_time / result.primal_time)
150148
catch e
151149
@show e
152150
if e isa ADIncorrectException

web/src/App.svelte

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@
102102
>Download the raw data (JSON)</a
103103
>
104104
</p>
105+
106+
<p>
107+
<b>Note about Enzyme:</b> Enzyme does not work with DynamicPPL 0.37
108+
/ Turing 0.40 because of
109+
<a
110+
href="https://github.com/EnzymeAD/Enzyme.jl/issues/2429"
111+
target="_blank">this issue</a
112+
>. If you want to use Enzyme with Turing, please use an older
113+
version of Turing / DynamicPPL.
114+
</p>
115+
105116
{#each categorisedData.entries() as [category, modelData]}
106117
<h3>{category}</h3>
107118
<ResultsTable data={modelData} {modelDefinitions} />

0 commit comments

Comments
 (0)