Turing.jl + Enyzme Examples

Just a small note for others reading this that the Enzyme API for setting the runtime activity has been updated, so that the usage would now be:

import ADTypes
import Enzyme
using Turing

@model function m()
    x ~ Normal()
    y ~ Normal(x, 1)
end

model = m()
sampler = NUTS(; adtype=ADTypes.AutoEnzyme(; mode=Enzyme.set_runtime_activity(Enzyme.Reverse)))
sample(model, sampler, 1000)
2 Likes