Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Cassette error when using with Turing #31

Open
mohamed82008 opened this issue Apr 29, 2020 · 5 comments
Open

Cassette error when using with Turing #31

mohamed82008 opened this issue Apr 29, 2020 · 5 comments

Comments

@mohamed82008
Copy link

I am trying to use this package with Turing.jl and I ran into the following error:

ERROR: MethodError: no method matching metadatatype(::Type{Cassette.Context{nametype(JacobianSparsityContext),Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{nametype(JacobianSparsityContext),0xcf4d328d8191b6e5,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}}, ::Type{Type})
Closest candidates are:
  metadatatype(::Type{#s16} where #s16<:(Cassette.Context{nametype(JacobianSparsityContext),M,T,P,B,H} where H<:Union{Cassette.DisableHooks, Nothing} where B<:Union{Nothing, IdDict{Module,Dict{Symbol,Cassette.BindingMeta}}} where P<:Cassette.AbstractPass where T<:Union{Nothing, Cassette.Tag} where M), ::Type{#s13} where #s13<:Number) at C:\Users\user\.julia\packages\SparsityDetection\ReiBv\src\jacobian.jl:68
  metadatatype(::Type{#s16} where #s16<:(Cassette.Context{nametype(JacobianSparsityContext),M,T,P,B,H} where H<:Union{Cassette.DisableHooks, Nothing} where B<:Union{Nothing, IdDict{Module,Dict{Symbol,Cassette.BindingMeta}}} where P<:Cassette.AbstractPass where T<:Union{Nothing, Cassette.Tag} where M), ::DataType) at C:\Users\user\.julia\packages\SparsityDetection\ReiBv\src\jacobian.jl:65
  metadatatype(::Type{#s15} where #s15<:Cassette.Context, ::DataType) at C:\Users\user\.julia\packages\Cassette\158rp\src\tagging.jl:233
Stacktrace:
 [1] metatype(::Type{Cassette.Context{nametype(JacobianSparsityContext),Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{nametype(JacobianSparsityContext),0xcf4d328d8191b6e5,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}}, ::Type{Type}) at C:\Users\user\.julia\packages\Cassette\158rp\src\tagging.jl:148
 [2] macro expansion at C:\Users\user\.julia\packages\Cassette\158rp\src\tagging.jl:254 [inlined]
 [3] metametatype(::Type{Cassette.Context{nametype(JacobianSparsityContext),Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{nametype(JacobianSparsityContext),0xcf4d328d8191b6e5,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}}, ::Type{Core.TypeName}) at C:\Users\user\.julia\packages\Cassette\158rp\src\tagging.jl:238
 [4] metatype(::Type{Cassette.Context{nametype(JacobianSparsityContext),Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{nametype(JacobianSparsityContext),0xcf4d328d8191b6e5,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}}, ::Type{Core.TypeName}) at C:\Users\user\.julia\packages\Cassette\158rp\src\tagging.jl:148
 [5] fetch_bindingmeta!(::Cassette.Context{nametype(JacobianSparsityContext),Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{nametype(JacobianSparsityContext),0xcf4d328d8191b6e5,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}, ::Module, ::Dict{Symbol,Cassette.BindingMeta}, ::Symbol, ::Core.TypeName) at C:\Users\user\.julia\packages\Cassette\158rp\src\tagging.jl:118
 [6] _tagged_globalref at C:\Users\user\.julia\packages\Cassette\158rp\src\tagging.jl:593 [inlined]
 [7] tagged_globalref at C:\Users\user\.julia\packages\Cassette\158rp\src\tagging.jl:568 [inlined]
 [8] fieldcount at .\reflection.jl:692 [inlined]
 [9] recurse(::Cassette.Context{nametype(JacobianSparsityContext),Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{nametype(JacobianSparsityContext),0xcf4d328d8191b6e5,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}, ::typeof(fieldcount), ::Type{Turing.Inference.HMCState{VarInfo{NamedTuple{(:m,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:m,Tuple{}},Int64},Array{Normal{Float64},1},Array{DynamicPPL.VarName{:m,Tuple{}},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},AdvancedHMC.StaticTrajectory{AdvancedHMC.EndPointTS,AdvancedHMC.Leapfrog{Float64}},AdvancedHMC.Adaptation.NoAdaptation,AdvancedHMC.PhasePoint{Array{Float64,1},AdvancedHMC.DualValue{Float64,Array{Float64,1}}}}}) at C:\Users\user\.julia\packages\Cassette\158rp\src\overdub.jl:0
 [10] overdub(::Cassette.Context{nametype(JacobianSparsityContext),Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{nametype(JacobianSparsityContext),0xcf4d328d8191b6e5,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}, ::Function, ::Type{T} where T) at C:\Users\user\.julia\packages\SparsityDetection\ReiBv\src\propagate_tags.jl:48
 [11] fieldnames at .\reflection.jl:172 [inlined]
 [12] recurse(::Cassette.Context{nametype(JacobianSparsityContext),Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{nametype(JacobianSparsityContext),0xcf4d328d8191b6e5,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}, ::typeof(fieldnames), ::Type{Turing.Inference.HMCState{VarInfo{NamedTuple{(:m,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:m,Tuple{}},Int64},Array{Normal{Float64},1},Array{DynamicPPL.VarName{:m,Tuple{}},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},AdvancedHMC.StaticTrajectory{AdvancedHMC.EndPointTS,AdvancedHMC.Leapfrog{Float64}},AdvancedHMC.Adaptation.NoAdaptation,AdvancedHMC.PhasePoint{Array{Float64,1},AdvancedHMC.DualValue{Float64,Array{Float64,1}}}}}) at C:\Users\user\.julia\packages\Cassette\158rp\src\overdub.jl:0
 [13] overdub(::Cassette.Context{nametype(JacobianSparsityContext),Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{nametype(JacobianSparsityContext),0xcf4d328d8191b6e5,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}, ::Function, ::Type{T} where T) at C:\Users\user\.julia\packages\SparsityDetection\ReiBv\src\propagate_tags.jl:48
 [14] has_eval_num at C:\Users\user\.julia\packages\DynamicPPL\qYYAO\src\sampler.jl:25 [inlined]
....

when running the code in the README of https://github.com/mohamed82008/TuringSparseDiff.jl in the environment there. The error message is much longer. The environment in TuringSparseDiff is needed because it uses special branches of Turing and DynamicPPL. Any help is appreciated :)

@shashi
Copy link
Collaborator

shashi commented Apr 30, 2020

Turing is giving me this:

julia> using Turing
[ Info: Precompiling Turing [fce5fe82-541a-59a6-adf8-730c64b5f9a0]
WARNING: could not import MCMCChains.AbstractChains into Turing
ERROR: LoadError: LoadError: UndefVarError: AbstractChains not defined
Stacktrace:
 [1] include(::String) at /home/shashi/.julia/packages/Turing/xFzfF/src/Turing.jl:1

Any ideas?

@shashi
Copy link
Collaborator

shashi commented Apr 30, 2020

]st says

  [fce5fe82] Turing v0.7.1

I can give you a longer list if needed

@mohamed82008
Copy link
Author

Are you in the TuringSparseDiff environment?

@shashi
Copy link
Collaborator

shashi commented May 1, 2020

Ohh I didn't realize I had to instantiate that Manifest file! Sorry my bad!

@mohamed82008
Copy link
Author

No worries, good luck :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants