Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.40.6

Error more loudly and usefully when attempting to use particle methods on Julia 1.12.

# 0.40.5

Bump Optimization.jl compatibility to include v5.
Expand Down
2 changes: 1 addition & 1 deletion 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.40.5"
version = "0.40.6"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
16 changes: 16 additions & 0 deletions src/mcmc/particle_mcmc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
### Particle Filtering and Particle MCMC Samplers.
###

LIBTASK_BROKEN = v"1.12.0" <= VERSION < v"1.12.2"
Copy link
Member

Choose a reason for hiding this comment

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

Could we also check against Pkg.develop's output, to check the Libtask version? Turing 0.40.6 might start to work if Libtask just puts out a bug fix release.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I am actually kind of unsure about this PR. I actually think that the correct solution is to fix the Julia compat bounds on Libtask itself. i.e. 0.9 should not declare compatibility with 1.12 until it is known to work with 1.12. That would require patching the General registry, which I don't mind doing.

Copy link
Member Author

Choose a reason for hiding this comment

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

The downside of that is that the latest version of Turing won't be able to load on 1.12 at all since it requires Libtask 0.9. Which is also quite bad, argh.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, not loading is bad. Also, you'd need to retrofix existing releases of Libtask, which could e.g. break existing environments that people already have in very surprising ways.


### AdvancedPS models and interface

"""
Expand Down Expand Up @@ -114,6 +116,13 @@ $(TYPEDFIELDS)
"""
struct SMC{R} <: ParticleInference
resampler::R

function SMC(resampler::R) where {R}
@static if LIBTASK_BROKEN
error("SMC is not yet supported on Julia v1.12; please use Julia v1.11")
end
return new{R}(resampler)
end
end

"""
Expand Down Expand Up @@ -255,6 +264,13 @@ struct PG{R} <: ParticleInference
nparticles::Int
"""Resampling algorithm."""
resampler::R

function PG(nparticles::Int, resampler::R) where {R}
@static if LIBTASK_BROKEN
error("PG is not yet supported on Julia v1.12; please use Julia v1.11")
end
return new{R}(nparticles, resampler)
end
end

"""
Expand Down