Turing.jl: errors during testing (HMC?)

Created on 14 Feb 2019  ยท  16Comments  ยท  Source: TuringLang/Turing.jl

Platform: Windows 10, Julia 1.1.0

running the following produces an error:
add Turing
test Turing

.... lines about things being updated

[bbc10e6e] + DynamicHMC v1.0.2+ #master (https://github.com/tpapp/DynamicHMC.jl)
[HMC] Finished with
Running time = 1.179192493000001;
Accept rate = 1.0;
#lf / sample = 0.9966666666666667;
#evals / sample = 2.9966666666666666;
pre-cond. metric = [1.0].
[HMC] Finished with
Running time = 1.9699e-5;
Accept rate = 1.0;
#lf / sample = 0.0;
#evals / sample = 2.0;
pre-cond. metric = [1.0].
[HMC] Finished with
Running time = 0.6601277;
Accept rate = 1.0;
#lf / sample = 0.5;
#evals / sample = 2.5;
pre-cond. metric = [1.0].
[-9.42436, -7.7163]
[-9.42436, -7.7163]
[ Info: [PG] Finished with
[ Info: Running time = 0.3503446859999997;
ERROR: Package Turing errored during testing

Using OSX 10.14, Julia 1.1.0, we have a similar result:

[bbc10e6e] + DynamicHMC v1.0.2+ #master (https://github.com/tpapp/DynamicHMC.jl)
[HMC] Finished with
Running time = 1.6609471790000014;
Accept rate = 0.9966666666666667;
#lf / sample = 0.9966666666666667;
#evals / sample = 2.9966666666666666;
pre-cond. metric = [1.0].
[HMC] Finished with
Running time = 3.3658e-5;
Accept rate = 1.0;
#lf / sample = 0.0;
#evals / sample = 2.0;
pre-cond. metric = [1.0].
[HMC] Finished with
Running time = 0.997483639;
Accept rate = 1.0;
#lf / sample = 0.5;
#evals / sample = 2.5;
pre-cond. metric = [1.0].
[0.200685, 1.2323]
[0.200685, 1.2323]
[ Info: [PG] Finished with
[ Info: Running time = 0.5600100159999993;
signal (11): Segmentation fault: 11
in expression starting at /Users/au/.julia/packages/Turing/FTRCE/test/compiler.jl/beta_binomial.jl:26
jl_swap_fiber at /Users/osx/buildbot/slave/package_osx64/build/src/task.c:778
Allocations: 140303015 (Pool: 140281852; Big: 21163); GC: 317
ERROR: Package Turing errored during testing

All 16 comments

Turing doesn't support Julia 1.1 yet, see https://github.com/TuringLang/Turing.jl/issues/657. Please try it on Julia 1.0.3.

Turing doesn't support Julia 1.1 yet, see #657. Please try it on Julia 1.0.3.

Ok, thanks!

We've made some progress; a fix should be coming soon.

This should be fixed in the latest release.

I'm on Julia 1.4.1 and Windows 10, I got the same failure message "Package Turing errored during testing." The first error is

"Simplex Tracker, Zygote and ReverseDiff (with and without caching) AD: Error During Test at ~.julia\packages\Turing\cReBm\test\core\ad.jl:269
Got exception outside of a @test
MethodError: no method matching AxisArrays.AxisArray(::Array{Float64,3}; iter=1:1:1000, var=["theta[2]", "theta[4]", "theta[3]", "theta[1]", "lp", "n_steps", "is_accept", "acceptance_rate", "log_density", "hamiltonian_energy", "hamiltonian_energy_error", "step_size", "nom_step_size"], chain=1:1)"

and then it goes on like that for a few pages.

This seems to be the same error as https://github.com/TuringLang/Turing.jl/issues/1220. Can you check that you use the latest version of MCMCChains (i.e., MCMCChains 3.0.12)?

Thank you I updated MCMCChains but it's still showing only 3.0.11 . How do I get 3.0.12?

Maybe some other package is holding it back. By running

julia> import Pkg; Pkg.add("[email protected]")

Pkg should tell you which other package conflicts with 3.0.12.

Ok figured this out.
Pkg.add(Pkg.PackageSpec(name="MCMCChains", version="3.0.12"))
gave output

Resolving package versions...
Installed IntervalSets โ”€ v0.4.0
Installed MCMCChains โ”€โ”€โ”€ v3.0.12
Installed AxisArrays โ”€โ”€โ”€ v0.4.2
Updating ~\.julia\environments\v1.4\Project.toml
[39de3d68] โ†‘ AxisArrays v0.4.0 โ‡’ v0.4.2
[c7f686f2] โ†‘ MCMCChains v3.0.11 โ‡’ v3.0.12
Updating ~\.julia\environments\v1.4\Manifest.toml
[39de3d68] โ†‘ AxisArrays v0.4.0 โ‡’ v0.4.2
[8197267c] โ†“ IntervalSets v0.5.0 โ‡’ v0.4.0
[c7f686f2] โ†‘ MCMCChains v3.0.11 โ‡’ v3.0.12

IntervalSets seems to be the conflicting package here. Also, this fixed my problems with Turing, thanks!

Great that it works now!

Umm still having trouble :-( I tried this code

using Turing
using StatsPlots

# Define a simple Normal model with unknown mean and variance.
@model gdemo(x, y) = begin
  s ~ InverseGamma(2, 3)
  m ~ Normal(0, sqrt(s))
  x ~ Normal(m, sqrt(s))
  y ~ Normal(m, sqrt(s))
end

#  Run sampler, collect results
chn = sample(gdemo(1.5, 2), HMC(0.1, 5), 1000)

# Summarise results (currently requires the master branch from MCMCChains)
describe(chn)

# Plot and save results
p = plot(chn)
savefig("gdemo-plot.png")

and got the same error:

MethodError: no method matching AxisArray(::Array{Float64,3}; iter=1:1:1000, var=["m", "s", "lp", "n_steps", "is_accept", "acceptance_rate", "log_density", "hamiltonian_energy", "hamiltonian_energy_error", "step_size", "nom_step_size"], chain=1:1)

MCMCChains is on v3.0.12, and Turing passed the Pkg.test("Turing") checks okay.

Hmm are you sure you are using the latest version of MCMCChains? Such models are tested in the Turing tests, so I'm a bit surprised that they pass and your example fails :open_mouth:

I am surprised as well. Yes, I just updated MCMCChains, and it shows version 3.0.12 and AxisArrays is v0.4.2 .

Ok it's working now! So Pkg.test("Turing") was working (tests passed) after updating MCMCChains, but I was getting error messages on simple examples. Apparently I had to shut down the IJulia notebook, and restart it. All very strange.

Oh, yes, after updating packages that are already loaded you should restart Julia (or in your case the IJulia kernel). Glad you figured it out!

Running Pkg.test("Turing") starts a different Julia process, so that's why the updated package was used there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Vaibhavdixit02 picture Vaibhavdixit02  ยท  4Comments

yebai picture yebai  ยท  6Comments

willtebbutt picture willtebbutt  ยท  4Comments

ClaudMor picture ClaudMor  ยท  4Comments

scheidan picture scheidan  ยท  5Comments