I have several results from an optimization serialized to disk. They are all NamedTuples result = (mdl = A Turing Model, chn = A Chains object)
Now I want to return predictions from a model in my test.qmd file:
---
title: "Turing Serialization Test"
format: pdf
engine: julia
julia:
exeflags: ["--project=@."]
env: ["JULIA_NUM_THREADS=5"]
---
```{julia}
#| label: packages-scripts
using CSV, DataFrames, Turing, StatsBase, Random, Plots, StatsPlots
using ApproxFun, CategoricalArrays, NamedArrays, LaTeXStrings, Loess
using ADTypes, KernelDensity, Serialization, DynamicPPL, LinearAlgebra
using BenchmarkTools, IterTools, StatProfilerHTML, ReverseDiff
using Suppressor, Distributions
## using Enzyme
include("../src/utils.jl")
include("../src/estimation.jl")
include("../src/loadgermdata.jl")
include("../src/diag.jl")
include("../src/diagplots.jl")
include("../src/diagchain.jl")
include("../src/diagrbf.jl")
include("../src/norm.jl")
include("../src/rbf.jl")
include("../src/analysis.jl")
r = deserialize("output/optim30-50")[1]
returned(r.mdl.mdl, r.chn)
However, when doing quarto render test.qmd
I get following error
UndefVarError: `Normal` not defined in `Main` Suggestion: check for spelling errors or missing imports.
```
Now, when putting the exact same code from the chunk into test.jl, it works. It also works when executing the code in test.qmd interactively and just sending it to the REPL. There are some Normal priors in the model. Any suggestions? I have no idea where to look for the error. For a simple toy model returned
works just fine after deserialize
.