Skip to content

Commit

Permalink
DynamicPPL -> 0.29; Julia -> 1.10; Tapir -> Mooncake (#2341)
Browse files Browse the repository at this point in the history
* CompatHelper: bump compat for DynamicPPL to 0.29, (keep existing compat) (#2339)

Co-authored-by: CompatHelper Julia <[email protected]>

* CompatHelper: bump compat for DynamicPPL to 0.29 for package test, (keep existing compat) (#2340)

Co-authored-by: CompatHelper Julia <[email protected]>

* Replace vectorize(d, r) -> DynamicPPL.tovec(r)

vectorize was removed in DynamicPPL 0.29.0

* Require Julia >= 1.9

* Add Julia 1.9 tests back

* Fix essential/ad tests

* Fix reconstruct calls in MH

* Update src/mcmc/mh.jl

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Require Julia 1.10

* Change 1 -> I in MvNormal()

setting a real number as σ is deprecated

* Simplify tests as we no longer support Julia <1.8

* Simplify `set_namedtuple!`

* Remove conditional loading/exporting of Tapir

* Tapir -> Mooncake

* Update src/essential/Essential.jl

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Remove Requires from Project.toml

* Bump minor version instead

* Restrict ADTypes to 1.9.0 for AutoMooncake()

* Re-enable Mooncake tests in mcmc/abstractmcmc

* Update the currently buggy and incorrect tilde overloads in `mh.jl` (#2360)

* More autoformatting (#2359)

* Bring more files into autoformatting fold

* Run JuliaFormatter

* Remove trailing whitespace

* Update comment in .JuliaFormatter.toml

* Fix bad merge

* Restrict Mooncake to >= 0.4.9

* Add MH test for LKJCholesky

* Remove Tracker

* Format imports

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Add AD imports to Optimisation test

* Bump Mooncake compat in tests

* Bump Libtask version

* Get Optimization tests to pass CI

* Update API docs

* Write a changelog entry

* Update docs/src/api.md

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: CompatHelper Julia <[email protected]>
Co-authored-by: Tor Erlend Fjelde <[email protected]>
Co-authored-by: Markus Hauru <[email protected]>
  • Loading branch information
5 people authored Oct 23, 2024
1 parent 24e6870 commit f388e61
Show file tree
Hide file tree
Showing 22 changed files with 180 additions and 225 deletions.
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'
- '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

2 comments on commit f388e61

@penelopeysm
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

  • Drop support for Julia 1.9 and earlier. Minimum Julia version is now 1.10.
  • Drop support for Tracker as an AD backend.
  • Replace Tapir.jl with its reincarnated form, Mooncake.jl.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/117933

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.35.0 -m "<description of version>" f388e61d6820af0ce6c14ab48fd9edb98e39e706
git push origin v0.35.0

Please sign in to comment.