Skip to content

Commit aca574f

Browse files
committed
Remove Tracker and replace with Mooncake, except in BNN doc
1 parent 89785e9 commit aca574f

File tree

6 files changed

+50
-13
lines changed

6 files changed

+50
-13
lines changed

Manifest.toml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
julia_version = "1.10.6"
44
manifest_format = "2.0"
5-
project_hash = "d445da060c06170cbd2a3f76f676702d3ccabd6c"
5+
project_hash = "46b1a3e94b0848456d070eb24006f64ff234812a"
66

77
[[deps.ADTypes]]
88
git-tree-sha1 = "72af59f5b8f09faee36b4ec48e014a79210f2f4f"
@@ -702,6 +702,12 @@ git-tree-sha1 = "23163d55f885173722d1e4cf0f6110cdbaf7e272"
702702
uuid = "b552c78f-8df3-52c6-915a-8e097449b14b"
703703
version = "1.15.1"
704704

705+
[[deps.DiffTests]]
706+
deps = ["LinearAlgebra", "SparseArrays", "Statistics"]
707+
git-tree-sha1 = "b92beb1933df01bf4915d3a05e54c2a0aad312c7"
708+
uuid = "de460e47-3fe3-5279-bb4a-814414816d5d"
709+
version = "0.1.2"
710+
705711
[[deps.DifferentialEquations]]
706712
deps = ["BoundaryValueDiffEq", "DelayDiffEq", "DiffEqBase", "DiffEqCallbacks", "DiffEqNoiseProcess", "JumpProcesses", "LinearAlgebra", "LinearSolve", "NonlinearSolve", "OrdinaryDiffEq", "Random", "RecursiveArrayTools", "Reexport", "SciMLBase", "SteadyStateDiffEq", "StochasticDiffEq", "Sundials"]
707713
git-tree-sha1 = "d55af9d6b51c54f81ae30d1a463206d32cc4c24a"
@@ -2103,6 +2109,11 @@ git-tree-sha1 = "ec4f7fbeab05d7747bdf98eb74d130a2a2ed298d"
21032109
uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
21042110
version = "1.2.0"
21052111

2112+
[[deps.MistyClosures]]
2113+
git-tree-sha1 = "1142aefd845c608f3c70e4c202c4aae725cab67b"
2114+
uuid = "dbe65cb8-6be2-42dd-bbc5-4196aaced4f4"
2115+
version = "2.0.0"
2116+
21062117
[[deps.Mmap]]
21072118
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
21082119

@@ -2112,6 +2123,32 @@ git-tree-sha1 = "2c140d60d7cb82badf06d8783800d0bcd1a7daa2"
21122123
uuid = "78c3b35d-d492-501b-9361-3d52fe80e533"
21132124
version = "0.8.1"
21142125

2126+
[[deps.Mooncake]]
2127+
deps = ["ADTypes", "ChainRules", "ChainRulesCore", "DiffRules", "DiffTests", "ExprTools", "FunctionWrappers", "Graphs", "InteractiveUtils", "LinearAlgebra", "MistyClosures", "Random", "Setfield", "Test"]
2128+
git-tree-sha1 = "9fa3c8c11fe5286badb9c24e8d2420b3a07f9a8c"
2129+
uuid = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
2130+
version = "0.4.50"
2131+
2132+
[deps.Mooncake.extensions]
2133+
MooncakeAllocCheckExt = "AllocCheck"
2134+
MooncakeCUDAExt = "CUDA"
2135+
MooncakeDynamicPPLExt = "DynamicPPL"
2136+
MooncakeJETExt = "JET"
2137+
MooncakeLuxLibExt = "LuxLib"
2138+
MooncakeLuxLibSLEEFPiratesExtension = ["LuxLib", "SLEEFPirates"]
2139+
MooncakeNNlibExt = "NNlib"
2140+
MooncakeSpecialFunctionsExt = "SpecialFunctions"
2141+
2142+
[deps.Mooncake.weakdeps]
2143+
AllocCheck = "9b6a8646-10ed-4001-bbdc-1d2f46dfbb1a"
2144+
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
2145+
DynamicPPL = "366bfd00-2699-11ea-058f-f148b4cae6d8"
2146+
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
2147+
LuxLib = "82251201-b29d-42c6-8e01-566dec8acb11"
2148+
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
2149+
SLEEFPirates = "476501e8-09a2-5ece-8869-fb82de89a1fa"
2150+
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
2151+
21152152
[[deps.MozillaCACerts_jll]]
21162153
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
21172154
version = "2023.1.10"

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
3333
Measures = "442fdcdd-2543-5da2-b0f3-8c86c306513e"
3434
Memoization = "6fafb56a-5788-4b4e-91ca-c0cea6611c73"
3535
MicroCanonicalHMC = "234d2aa0-2291-45f7-9047-6fa6f316b0a8"
36+
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
3637
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
3738
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
3839
OptimizationNLopt = "4e6fcdb7-1186-4e1f-a706-475e75c168bb"
@@ -48,7 +49,6 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
4849
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
4950
StatsFuns = "4c63d2b9-4356-54db-8cca-17b64c39e42c"
5051
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"
51-
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
5252
Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
5353
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"
5454
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

tutorials/10-bayesian-differential-equations/index.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ More theoretical details on these methods can be found at: https://docs.sciml.ai
320320
While these sensitivity analysis methods may seem complicated, using them is dead simple.
321321
Here is a version of the Lotka-Volterra model using adjoint sensitivities.
322322

323-
All we have to do is switch the AD backend to one of the adjoint-compatible backends (ReverseDiff, Tracker, or Zygote)!
323+
All we have to do is switch the AD backend to one of the adjoint-compatible backends (ReverseDiff or Zygote)!
324324
Notice that on this model adjoints are slower.
325325
This is because adjoints have a higher overhead on small parameter models and therefore we suggest using these methods only for models with around 100 parameters or more.
326326
For more details, see https://arxiv.org/abs/1812.01892.

tutorials/docs-10-using-turing-autodiff/index.qmd

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ Pkg.instantiate();
1212

1313
## Switching AD Modes
1414

15-
Turing currently supports four automatic differentiation (AD) backends for sampling: [ForwardDiff](https://github.com/JuliaDiff/ForwardDiff.jl) for forward-mode AD; and [ReverseDiff](https://github.com/JuliaDiff/ReverseDiff.jl), [Zygote](https://github.com/FluxML/Zygote.jl), and [Tracker](https://github.com/FluxML/Tracker.jl) for reverse-mode AD.
16-
While `Tracker` is still available, its use is discouraged due to a lack of active maintenance.
17-
`ForwardDiff` is automatically imported by Turing. To utilize `Zygote` or `ReverseDiff` for AD, users must explicitly import them with `using Zygote` or `using ReverseDiff`, alongside `using Turing`.
15+
Turing currently supports four automatic differentiation (AD) backends for sampling: [ForwardDiff](https://github.com/JuliaDiff/ForwardDiff.jl) for forward-mode AD; and [Mooncake](https://github.com/compintell/Mooncake.jl), [ReverseDiff](https://github.com/JuliaDiff/ReverseDiff.jl), and [Zygote](https://github.com/FluxML/Zygote.jl) for reverse-mode AD.
16+
`ForwardDiff` is automatically imported by Turing. To utilize `Mooncake`, `Zygote`, or `ReverseDiff` for AD, users must explicitly import them with `import Mooncake`, `import Zygote` or `import ReverseDiff`, alongside `using Turing`.
1817

1918
As of Turing version v0.30, the global configuration flag for the AD backend has been removed in favour of [`AdTypes.jl`](https://github.com/SciML/ADTypes.jl), allowing users to specify the AD backend for individual samplers independently.
2019
Users can pass the `adtype` keyword argument to the sampler constructor to select the desired AD backend, with the default being `AutoForwardDiff(; chunksize=0)`.
@@ -62,4 +61,4 @@ c = sample(
6261

6362
Generally, reverse-mode AD, for instance `ReverseDiff`, is faster when sampling from variables of high dimensionality (greater than 20), while forward-mode AD, for instance `ForwardDiff`, is more efficient for lower-dimension variables. This functionality allows those who are performance sensitive to fine tune their automatic differentiation for their specific models.
6463

65-
If the differentiation method is not specified in this way, Turing will default to using whatever the global AD backend is. Currently, this defaults to `ForwardDiff`.
64+
If the differentiation method is not specified in this way, Turing will default to using whatever the global AD backend is. Currently, this defaults to `ForwardDiff`.

tutorials/docs-12-using-turing-guide/index.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ ForwardDiff (Turing's default AD backend) uses forward-mode chunk-wise AD. The c
514514

515515
#### AD Backend
516516

517-
Turing supports four automatic differentiation (AD) packages in the back end during sampling. The default AD backend is [ForwardDiff](https://github.com/JuliaDiff/ForwardDiff.jl) for forward-mode AD. Three reverse-mode AD backends are also supported, namely [Tracker](https://github.com/FluxML/Tracker.jl), [Zygote](https://github.com/FluxML/Zygote.jl) and [ReverseDiff](https://github.com/JuliaDiff/ReverseDiff.jl). `Zygote` and `ReverseDiff` are supported optionally if explicitly loaded by the user with `using Zygote` or `using ReverseDiff` next to `using Turing`.
517+
Turing supports four automatic differentiation (AD) packages in the back end during sampling. The default AD backend is [ForwardDiff](https://github.com/JuliaDiff/ForwardDiff.jl) for forward-mode AD. Three reverse-mode AD backends are also supported, namely [Mooncake](https://github.com/compintell/Mooncake.jl), [Zygote](https://github.com/FluxML/Zygote.jl) and [ReverseDiff](https://github.com/JuliaDiff/ReverseDiff.jl). `Mooncake`, `Zygote`, and `ReverseDiff` also require the user to explicitly load them using `import Mooncake`, `import Zygote`, or `import ReverseDiff` next to `using Turing`.
518518

519519
For more information on Turing's automatic differentiation backend, please see the [Automatic Differentiation]({{<meta using-turing-autodiff>}}) article.
520520

tutorials/docs-13-using-turing-performance-tips/index.qmd

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,20 @@ end
4343
## Choose your AD backend
4444

4545
Automatic differentiation (AD) makes it possible to use modern, efficient gradient-based samplers like NUTS and HMC, and that means a good AD system is incredibly important. Turing currently
46-
supports several AD backends, including [ForwardDiff](https://github.com/JuliaDiff/ForwardDiff.jl) (the default), [Zygote](https://github.com/FluxML/Zygote.jl),
47-
[ReverseDiff](https://github.com/JuliaDiff/ReverseDiff.jl), and [Tracker](https://github.com/FluxML/Tracker.jl). Experimental support is also available for
48-
[Tapir](https://github.com/withbayes/Tapir.jl).
46+
supports several AD backends, including [ForwardDiff](https://github.com/JuliaDiff/ForwardDiff.jl) (the default),
47+
[Mooncake](https://github.com/compintell/Mooncake.jl),
48+
[Zygote](https://github.com/FluxML/Zygote.jl), and
49+
[ReverseDiff](https://github.com/JuliaDiff/ReverseDiff.jl).
4950

5051
For many common types of models, the default ForwardDiff backend performs great, and there is no need to worry about changing it. However, if you need more speed, you can try
5152
different backends via the standard [ADTypes](https://github.com/SciML/ADTypes.jl) interface by passing an `AbstractADType` to the sampler with the optional `adtype` argument, e.g.
5253
`NUTS(adtype = AutoZygote())`. See [Automatic Differentiation]({{<meta using-turing-autodiff>}}) for details. Generally, `adtype = AutoForwardDiff()` is likely to be the fastest and most reliable for models with
5354
few parameters (say, less than 20 or so), while reverse-mode backends such as `AutoZygote()` or `AutoReverseDiff()` will perform better for models with many parameters or linear algebra
5455
operations. If in doubt, it's easy to try a few different backends to see how they compare.
5556

56-
### Special care for Zygote and Tracker
57+
### Special care for Zygote
5758

58-
Note that Zygote and Tracker will not perform well if your model contains `for`-loops, due to the way reverse-mode AD is implemented in these packages. Zygote also cannot differentiate code
59+
Note that Zygote will not perform well if your model contains `for`-loops, due to the way reverse-mode AD is implemented in these packages. Zygote also cannot differentiate code
5960
that contains mutating operations. If you can't implement your model without `for`-loops or mutation, `ReverseDiff` will be a better, more performant option. In general, though,
6061
vectorized operations are still likely to perform best.
6162

0 commit comments

Comments
 (0)