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

DynamicPPL -> 0.29; Julia -> 1.10; Tapir -> Mooncake #2341

Merged
merged 35 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b36c8b2
CompatHelper: bump compat for DynamicPPL to 0.29, (keep existing comp…
github-actions[bot] Sep 25, 2024
3568649
CompatHelper: bump compat for DynamicPPL to 0.29 for package test, (k…
github-actions[bot] Sep 25, 2024
f43e57d
Replace vectorize(d, r) -> DynamicPPL.tovec(r)
penelopeysm Sep 25, 2024
c8e2337
Require Julia >= 1.9
penelopeysm Sep 26, 2024
97d6869
Add Julia 1.9 tests back
penelopeysm Oct 2, 2024
aac4628
Fix essential/ad tests
penelopeysm Oct 2, 2024
36e4651
Fix reconstruct calls in MH
penelopeysm Oct 3, 2024
2995791
Update src/mcmc/mh.jl
penelopeysm Oct 3, 2024
8387f50
Require Julia 1.10
penelopeysm Oct 3, 2024
410d98e
Change 1 -> I in MvNormal()
penelopeysm Oct 3, 2024
ed17b7e
Simplify tests as we no longer support Julia <1.8
penelopeysm Oct 3, 2024
97ed363
Simplify `set_namedtuple!`
penelopeysm Oct 3, 2024
b9b68c4
Remove conditional loading/exporting of Tapir
penelopeysm Oct 3, 2024
f42d3d8
Tapir -> Mooncake
penelopeysm Oct 3, 2024
7b22570
Update src/essential/Essential.jl
penelopeysm Oct 3, 2024
5e56f09
Remove Requires from Project.toml
penelopeysm Oct 3, 2024
d6d0d21
Bump minor version instead
penelopeysm Oct 3, 2024
e9e20dc
Restrict ADTypes to 1.9.0 for AutoMooncake()
penelopeysm Oct 3, 2024
452d0d0
Re-enable Mooncake tests in mcmc/abstractmcmc
penelopeysm Oct 3, 2024
b0bb31e
Update the currently buggy and incorrect tilde overloads in `mh.jl` (…
torfjelde Oct 7, 2024
2e178d7
More autoformatting (#2359)
mhauru Oct 4, 2024
517e9fb
Fix bad merge
penelopeysm Oct 7, 2024
188bd80
Restrict Mooncake to >= 0.4.9
penelopeysm Oct 7, 2024
a277c29
Add MH test for LKJCholesky
penelopeysm Oct 7, 2024
0156002
Merge branch 'master' into ch
penelopeysm Oct 7, 2024
742364e
Remove Tracker
penelopeysm Oct 10, 2024
f2cc183
Format imports
penelopeysm Oct 11, 2024
b60d907
Add AD imports to Optimisation test
penelopeysm Oct 11, 2024
510ee44
Merge branch 'master' into ch
penelopeysm Oct 21, 2024
1c039f6
Bump Mooncake compat in tests
penelopeysm Oct 21, 2024
cce79c0
Bump Libtask version
penelopeysm Oct 22, 2024
0f46682
Get Optimization tests to pass CI
penelopeysm Oct 22, 2024
d9bc88a
Update API docs
penelopeysm Oct 22, 2024
5f55f30
Write a changelog entry
penelopeysm Oct 22, 2024
9fb9e95
Update docs/src/api.md
penelopeysm Oct 22, 2024
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
46 changes: 28 additions & 18 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,35 @@ on:

jobs:
test:
# Use matrix.test.name here to avoid it taking up the entire window width
name: test ${{matrix.test.name}} (${{ matrix.os }}, ${{ matrix.version }}, ${{ matrix.arch }}, ${{ matrix.num_threads }})
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.version == 'nightly' }}

strategy:
fail-fast: false
matrix:
test-args:
test:
# Run some of the slower test files individually. The last one catches everything
# not included in the others.
- "essential/ad.jl"
- "mcmc/gibbs.jl"
- "mcmc/hmc.jl"
- "mcmc/abstractmcmc.jl"
- "mcmc/Inference.jl"
- "experimental/gibbs.jl"
- "mcmc/ess.jl"
- "--skip essential/ad.jl mcmc/gibbs.jl mcmc/hmc.jl mcmc/abstractmcmc.jl mcmc/Inference.jl experimental/gibbs.jl mcmc/ess.jl"
- name: "essential/ad"
args: "essential/ad.jl"
- name: "mcmc/gibbs"
args: "mcmc/gibbs.jl"
- name: "mcmc/hmc"
args: "mcmc/hmc.jl"
- name: "mcmc/abstractmcmc"
args: "mcmc/abstractmcmc.jl"
- name: "mcmc/Inference"
args: "mcmc/Inference.jl"
- name: "experimental/gibbs"
args: "experimental/gibbs.jl"
- name: "mcmc/ess"
args: "mcmc/ess.jl"
- name: "everything else"
args: "--skip essential/ad.jl mcmc/gibbs.jl mcmc/hmc.jl mcmc/abstractmcmc.jl mcmc/Inference.jl experimental/gibbs.jl mcmc/ess.jl"
version:
- '1.7'
penelopeysm marked this conversation as resolved.
Show resolved Hide resolved
penelopeysm marked this conversation as resolved.
Show resolved Hide resolved
- '1.10'
- '1'
os:
- ubuntu-latest
Expand All @@ -39,7 +49,7 @@ jobs:
- 1
- 2
exclude:
# With Windows and macOS, only run Julia 1.7, x64, 2 threads. We just want to see
# With Windows and macOS, only run x64, 2 threads. We just want to see
# some combination work on OSes other than Ubuntu.
- os: windows-latest
version: '1'
Expand All @@ -53,11 +63,11 @@ jobs:
num_threads: 1
- os: macOS-latest
num_threads: 1
# It's sufficient to test x86 with one version of Julia and one thread.
- version: '1'
arch: x86
- num_threads: 2
arch: x86
# It's sufficient to test x86 with only Julia 1.10 and 1 thread.
- arch: x86
version: '1'
- arch: x86
num_threads: 2

steps:
- name: Print matrix variables
Expand All @@ -66,7 +76,7 @@ jobs:
echo "Architecture: ${{ matrix.arch }}"
echo "Julia version: ${{ matrix.version }}"
echo "Number of threads: ${{ matrix.num_threads }}"
echo "Test arguments: ${{ matrix.test-args }}"
echo "Test arguments: ${{ matrix.test.args }}"
- name: (De)activate coverage analysis
run: echo "COVERAGE=${{ matrix.version == '1' && matrix.os == 'ubuntu-latest' && matrix.num_threads == 2 }}" >> "$GITHUB_ENV"
shell: bash
Expand All @@ -81,7 +91,7 @@ jobs:
# Custom calls of Pkg.test tend to miss features such as e.g. adjustments for CompatHelper PRs
# Ref https://github.com/julia-actions/julia-runtest/pull/73
- name: Call Pkg.test
run: julia --color=yes --inline=yes --depwarn=yes --check-bounds=yes --threads=${{ matrix.num_threads }} --project=@. -e 'import Pkg; Pkg.test(; coverage=parse(Bool, ENV["COVERAGE"]), test_args=ARGS)' -- ${{ matrix.test-args }}
run: julia --color=yes --inline=yes --depwarn=yes --check-bounds=yes --threads=${{ matrix.num_threads }} --project=@. -e 'import Pkg; Pkg.test(; coverage=parse(Bool, ENV["COVERAGE"]), test_args=ARGS)' -- ${{ matrix.test.args }}
- uses: julia-actions/julia-processcoverage@v1
if: ${{ env.COVERAGE }}
- uses: codecov/codecov-action@v4
Expand Down
11 changes: 11 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Release 0.35.0

## Breaking changes

Julia 1.10 is now the minimum required version for Turing.

Tapir.jl has been removed and replaced with its successor, Mooncake.jl.
You can use Mooncake.jl by passing `adbackend=AutoMooncake(; config=nothing)` to the relevant samplers.

Support for Tracker.jl as an AD backend has been removed.

# Release 0.33.0

## Breaking changes
Expand Down
20 changes: 9 additions & 11 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Turing"
uuid = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
version = "0.34.1"
version = "0.35.0"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down Expand Up @@ -32,7 +32,6 @@ OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Expand All @@ -49,45 +48,44 @@ TuringDynamicHMCExt = "DynamicHMC"
TuringOptimExt = "Optim"

[compat]
ADTypes = "0.2, 1"
ADTypes = "1.9"
AbstractMCMC = "5.2"
Accessors = "0.1"
AdvancedHMC = "0.3.0, 0.4.0, 0.5.2, 0.6"
AdvancedMH = "0.8"
AdvancedPS = "0.6.0"
AdvancedVI = "0.2"
BangBang = "0.4"
BangBang = "0.4.2"
Bijectors = "0.13.6"
Compat = "4.15.0"
DataStructures = "0.18"
Distributions = "0.23.3, 0.24, 0.25"
DistributionsAD = "0.6"
DocStringExtensions = "0.8, 0.9"
DynamicHMC = "3.4"
DynamicPPL = "0.28.2"
Compat = "4.15.0"
DynamicPPL = "0.29"
EllipticalSliceSampling = "0.5, 1, 2"
ForwardDiff = "0.10.3"
Libtask = "0.7, 0.8"
Libtask = "0.8.8"
LinearAlgebra = "1"
LogDensityProblems = "2"
LogDensityProblemsAD = "1.7.0"
MCMCChains = "5, 6"
NamedArrays = "0.9, 0.10"
Optim = "1"
Optimization = "3"
OptimizationOptimJL = "0.1, 0.2, 0.3"
OrderedCollections = "1"
Printf = "1"
Random = "1"
Optim = "1"
Reexport = "0.2, 1"
Requires = "0.5, 1.0"
SciMLBase = "1.92.1, 2"
SciMLBase = "2"
SpecialFunctions = "0.7.2, 0.8, 0.9, 0.10, 1, 2"
Statistics = "1.6"
StatsAPI = "1.6"
StatsBase = "0.32, 0.33, 0.34"
StatsFuns = "0.8, 0.9, 1"
julia = "1.7"
julia = "1.10"

[extras]
DynamicHMC = "bbc10e6e-7c05-544b-b16e-64fede858acb"
Expand Down
13 changes: 6 additions & 7 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,12 @@ See the [variational inference tutorial](https://turinglang.org/docs/tutorials/0
These are used to specify the automatic differentiation backend to use.
See the [AD guide](https://turinglang.org/docs/tutorials/docs-10-using-turing-autodiff/) for more information.

| Exported symbol | Documentation | Description |
|:----------------- |:------------------------------------ |:----------------------------------------- |
| `AutoForwardDiff` | [`ADTypes.AutoForwardDiff`](@extref) | ForwardDiff.jl backend |
| `AutoReverseDiff` | [`ADTypes.AutoReverseDiff`](@extref) | ReverseDiff.jl backend |
| `AutoZygote` | [`ADTypes.AutoZygote`](@extref) | Zygote.jl backend |
| `AutoTracker` | [`ADTypes.AutoTracker`](@extref) | Tracker.jl backend |
| `AutoTapir` | [`ADTypes.AutoTapir`](@extref) | Tapir.jl backend, only for ADTypes >= 1.0 |
| Exported symbol | Documentation | Description |
|:----------------- |:------------------------------------ |:---------------------- |
| `AutoForwardDiff` | [`ADTypes.AutoForwardDiff`](@extref) | ForwardDiff.jl backend |
| `AutoReverseDiff` | [`ADTypes.AutoReverseDiff`](@extref) | ReverseDiff.jl backend |
| `AutoZygote` | [`ADTypes.AutoZygote`](@extref) | Zygote.jl backend |
| `AutoMooncake` | [`ADTypes.AutoMooncake`](@extref) | Mooncake.jl backend |

### Debugging

Expand Down
22 changes: 1 addition & 21 deletions src/Turing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export @model, # modelling
AutoForwardDiff, # ADTypes
AutoReverseDiff,
AutoZygote,
AutoTracker,
AutoMooncake,
setprogress!, # debugging
Flat,
FlatPos,
Expand Down Expand Up @@ -136,24 +136,4 @@ export @model, # modelling
MAP,
MLE

# AutoTapir is only supported by ADTypes v1.0 and above.
@static if VERSION >= v"1.10" && pkgversion(ADTypes) >= v"1"
export AutoTapir
end

if !isdefined(Base, :get_extension)
using Requires
end

function __init__()
@static if !isdefined(Base, :get_extension)
@require Optim = "429524aa-4258-5aef-a3af-852621145aeb" include(
"../ext/TuringOptimExt.jl"
)
@require DynamicHMC = "bbc10e6e-7c05-544b-b16e-64fede858acb" include(
"../ext/TuringDynamicHMCExt.jl"
)
end
end

end
10 changes: 2 additions & 8 deletions src/essential/Essential.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using Bijectors: PDMatDistribution
using AdvancedVI
using StatsFuns: logsumexp, softmax
@reexport using DynamicPPL
using ADTypes: ADTypes, AutoForwardDiff, AutoTracker, AutoReverseDiff, AutoZygote
using ADTypes: ADTypes, AutoForwardDiff, AutoReverseDiff, AutoZygote, AutoMooncake

using AdvancedPS: AdvancedPS

Expand All @@ -20,16 +20,10 @@ include("container.jl")
export @model,
@varname,
AutoForwardDiff,
AutoTracker,
AutoZygote,
AutoReverseDiff,
AutoMooncake,
@logprob_str,
@prob_str

# AutoTapir is only supported by ADTypes v1.0 and above.
@static if VERSION >= v"1.10" && pkgversion(ADTypes) >= v"1"
using ADTypes: AutoTapir
export AutoTapir
end

end # module
1 change: 0 additions & 1 deletion src/mcmc/Inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ using DynamicPPL:
getlogp,
VarName,
getsym,
vectorize,
_getvns,
getdist,
Model,
Expand Down
2 changes: 1 addition & 1 deletion src/mcmc/ess.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ struct ESSPrior{M<:Model,S<:Sampler{<:ESS},V<:AbstractVarInfo,T}
dist = getdist(varinfo, vn)
EllipticalSliceSampling.isgaussian(typeof(dist)) ||
error("[ESS] only supports Gaussian prior distributions")
vectorize(dist, mean(dist))
DynamicPPL.tovec(mean(dist))
end
return new{M,S,V,typeof(μ)}(model, sampler, varinfo, μ)
end
Expand Down
Loading
Loading