Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed incorrect calls to to_linked_internal_transform #726

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

torfjelde
Copy link
Member

Came across these isuse when trying the following with JET.jl 👀

julia> using DynamicPPL, Distributions, JET

julia> @model function demo()
           x = Vector{Float64}(undef, 2)
           x[1] ~ Normal()
           x[2] ~ Normal()
           return x
       end
demo (generic function with 4 methods)

julia> model = demo();

julia> vi = DynamicPPL.typed_varinfo(model);

julia> for vn in keys(vi)
           DynamicPPL.set_flag!(vi, vn, "del")
       end^C

julia> f, argtypes = DynamicPPL.DebugUtils.gen_evaluator_call_with_types(model, DynamicPPL.typed_varinfo(model), SamplingContext());

julia> report_call(f, argtypes)
═════ 1 possible error found ═════
┌ demo(__model__::Model{…}, __varinfo__::TypedVarInfo{…}, __context__::SamplingContext{…}) @ Main ./REPL[124]:4
│┌ tilde_assume!!(context::SamplingContext{…}, right::Normal{…}, vn::VarName{…}, vi::TypedVarInfo{…}) @ DynamicPPL /Users/tfjelde/.julia/packages/DynamicPPL/Awq82/src/context_implementations.jl:144
││┌ tilde_assume(context::SamplingContext{…}, right::Normal{…}, vn::VarName{…}, vi::TypedVarInfo{…}) @ DynamicPPL /Users/tfjelde/.julia/packages/DynamicPPL/Awq82/src/context_implementations.jl:52
│││┌ tilde_assume(::Random.TaskLocalRNG, ::DefaultContext, ::SampleFromPrior, ::Normal{…}, ::VarName{…}, ::TypedVarInfo{…}) @ DynamicPPL /Users/tfjelde/.julia/packages/DynamicPPL/Awq82/src/context_implementations.jl:67
││││┌ tilde_assume(::DynamicPPL.IsLeaf, rng::Random.TaskLocalRNG, context::DefaultContext, sampler::SampleFromPrior, right::Normal{…}, vn::VarName{…}, vi::TypedVarInfo{…}) @ DynamicPPL /Users/tfjelde/.julia/packages/DynamicPPL/Awq82/src/context_implementations.jl:72
│││││┌ assume(rng::Random.TaskLocalRNG, sampler::SampleFromPrior, dist::Normal{…}, vn::VarName{…}, vi::TypedVarInfo{…}) @ DynamicPPL /Users/tfjelde/.julia/packages/DynamicPPL/Awq82/src/context_implementations.jl:260
││││││ no matching method found `to_linked_internal_transform(::TypedVarInfo{@NamedTuple{x::DynamicPPL.Metadata{Dict{VarName{:x, Accessors.IndexLens{Tuple{Int64}}}, Int64}, Vector{Normal{Float64}}, Vector{VarName{:x, Accessors.IndexLens{Tuple{Int64}}}}, Vector{Float64}, Vector{Set{DynamicPPL.Selector}}}}, Float64}, ::Normal{Float64})`: f = DynamicPPL.to_linked_internal_transform(vi::TypedVarInfo{@NamedTuple{x::DynamicPPL.Metadata{Dict{…}, Vector{…}, Vector{…}, Vector{…}, Vector{…}}}, Float64}, dist::Normal{Float64})
│││││└────────────────────

@torfjelde
Copy link
Member Author

This raises the quesitons as to whether it would be worth making use of test_call and test_opt from JET.jl for certain cases, e.g. the demo models 👀

Copy link

codecov bot commented Nov 27, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 84.35%. Comparing base (48921d3) to head (361c45e).

Files with missing lines Patch % Lines
src/context_implementations.jl 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #726   +/-   ##
=======================================
  Coverage   84.35%   84.35%           
=======================================
  Files          35       35           
  Lines        4212     4212           
=======================================
  Hits         3553     3553           
  Misses        659      659           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@coveralls
Copy link

coveralls commented Nov 27, 2024

Pull Request Test Coverage Report for Build 12058780410

Details

  • 0 of 2 (0.0%) changed or added relevant lines in 1 file are covered.
  • 25 unchanged lines in 4 files lost coverage.
  • Overall coverage remained the same at 84.354%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/context_implementations.jl 0 2 0.0%
Files with Coverage Reduction New Missed Lines %
src/model.jl 1 93.68%
src/varinfo.jl 6 86.3%
src/simple_varinfo.jl 6 86.6%
src/threadsafe.jl 12 57.76%
Totals Coverage Status
Change from base Build 12056044639: 0.0%
Covered Lines: 3553
Relevant Lines: 4212

💛 - Coveralls

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

Successfully merging this pull request may close these issues.

2 participants