Skip to content

Revert "Proper support for distributions with embedded support" #486

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

Closed

Conversation

devmotion
Copy link
Member

Reverts #462

Since Turing tests fail.

@@ -206,8 +206,7 @@ DynamicPPL.link!!
DynamicPPL.invlink!!
DynamicPPL.default_transformation
DynamicPPL.maybe_invlink_before_eval!!
DynamicPPL.reconstruct
```
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
```
```

@torfjelde
Copy link
Member

Before we revert this change: the only test that is failing is a Tracker-related one 😬 I'm preferential to just marking this as broken for now.

@devmotion
Copy link
Member Author

Do we test ReverseDiff as well? I would expect that it is broken as well since the issue looks to me like the FillArrays problem. It seems we run tests with FillArrays 1.2.0, so fixing the FillArrays compat (TuringLang/DistributionsAD.jl#248) might be sufficient I assume.

@coveralls
Copy link

coveralls commented Jun 16, 2023

Pull Request Test Coverage Report for Build 5314270448

  • 36 of 75 (48.0%) changed or added relevant lines in 5 files are covered.
  • 23 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-1.5%) to 74.209%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/utils.jl 0 1 0.0%
src/simple_varinfo.jl 3 7 42.86%
src/context_implementations.jl 4 9 44.44%
src/varinfo.jl 26 55 47.27%
Files with Coverage Reduction New Missed Lines %
src/distribution_wrappers.jl 1 50.0%
src/context_implementations.jl 3 57.79%
src/varinfo.jl 19 72.59%
Totals Coverage Status
Change from base Build 5314259782: -1.5%
Covered Lines: 1830
Relevant Lines: 2466

💛 - Coveralls

@codecov
Copy link

codecov bot commented Jun 16, 2023

Codecov Report

Patch coverage: 48.00% and project coverage change: -1.51 ⚠️

Comparison is base (7b01d25) 75.71% compared to head (2c164b2) 74.20%.

❗ Current head 2c164b2 differs from pull request most recent head c1cf27d. Consider uploading reports for the commit c1cf27d to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #486      +/-   ##
==========================================
- Coverage   75.71%   74.20%   -1.51%     
==========================================
  Files          21       21              
  Lines        2487     2466      -21     
==========================================
- Hits         1883     1830      -53     
- Misses        604      636      +32     
Impacted Files Coverage Δ
src/DynamicPPL.jl 100.00% <ø> (ø)
src/abstract_varinfo.jl 84.84% <ø> (-4.29%) ⬇️
src/threadsafe.jl 21.50% <ø> (+0.22%) ⬆️
src/utils.jl 74.48% <0.00%> (+0.23%) ⬆️
src/simple_varinfo.jl 62.56% <42.85%> (-0.21%) ⬇️
src/context_implementations.jl 57.79% <44.44%> (-0.16%) ⬇️
src/varinfo.jl 72.58% <47.27%> (-5.23%) ⬇️
src/transforming.jl 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@torfjelde
Copy link
Member

Do we test ReverseDiff as well? I would expect that it is broken as well since the issue looks to me like the FillArrays problem. It seems we run tests with FillArrays 1.2.0, so fixing the FillArrays compat (TuringLang/DistributionsAD.jl#248) might be sufficient I assume.

This is the integrations tests with Turing, so all backends should be tested.

@devmotion
Copy link
Member Author

Based on the log (https://github.com/TuringLang/DynamicPPL.jl/actions/runs/5278661944/jobs/9548298259#step:6:1893) the test issue is in a separate test outside of the AD loop: https://github.com/TuringLang/Turing.jl/blob/6a307cd31ce62667773dc7958927255bdb4699c8/test/essential/ad.jl#L99 There ReverseDiff is explicitly disabled since apparently it already failed previously. (And the AD loop only includes ForwardDiff and ReverseDiff?)

@torfjelde
Copy link
Member

Oooooo I didn't think of the fact that it might be disabled in Turing. My bad!

@torfjelde
Copy link
Member

But yeah, then you're probably right that it's because of the FillArrays stuff.

@torfjelde
Copy link
Member

torfjelde commented Jun 16, 2023

But have you seen the perf-regressions in the DistributionsAD.jl PR you linked? ForwardDiff takes 220mins to run the tests..

Uncertain if that's what we want to do 😕

@devmotion
Copy link
Member Author

But have you seen the perf-regressions in the DistributionsAD.jl PR you linked? ForwardDiff takes 220mins to run the tests..

But is that new? I had seen extreme ForwardDiff times before, it was usually massively slow IIRC.

@torfjelde
Copy link
Member

But is that new? I had seen extreme ForwardDiff times before, it was usually massively slow IIRC.

I'll double check!

@torfjelde
Copy link
Member

torfjelde commented Jun 16, 2023

Nope, you're right! Also incrediblly slow on master 👍 I thought I experienced differently on the other PR but must have just been my perception.

EDIT: Maybe the 👍 isn't quite the right sentiment 🙃

@torfjelde
Copy link
Member

torfjelde commented Jun 16, 2023

Based on the log (https://github.com/TuringLang/DynamicPPL.jl/actions/runs/5278661944/jobs/9548298259#step:6:1893) the test issue is in a separate test outside of the AD loop: https://github.com/TuringLang/Turing.jl/blob/6a307cd31ce62667773dc7958927255bdb4699c8/test/essential/ad.jl#L99 There ReverseDiff is explicitly disabled since apparently it already failed previously. (And the AD loop only includes ForwardDiff and ReverseDiff?)

Looking at this though, it's not obvious to me how this is related to FillArrays? Moreover, the example in there runs perfectly on my end 😬

EDIT: Nvm, wait. I wasn't running using the correct version!

@torfjelde
Copy link
Member

Nah, it's actually working just fine:

julia> Turing.setadbackend(:tracker)
┌ Warning: Usage of Tracker.jl with Turing.jl is no longer being actively tested and maintained; please use at your own risk. See Zygote.jl or ReverseDiff.jl for fully supported reverse-mode backends.
└ @ Turing.Essential ~/.julia/packages/Turing/cplDJ/src/essential/ad.jl:15
^P^P:tracker

julia> sample(invwishart(), HMC(0.01, 1), 1000);
Sampling 100%|██████████████████████████████████████████████████████████████████████████████████████| Time: 0:00:07

(jl_8mpQcR) pkg> st
Status `/tmp/jl_8mpQcR/Project.toml`
  [366bfd00] DynamicPPL v0.23.0 `https://github.com/TuringLang/DynamicPPL.jl.git#master`
  [fce5fe82] Turing v0.26.0

@devmotion
Copy link
Member Author

What exactly? I can reproduce the error in a clean environment by running

julia> ] add DynamicPPL#master Turing

julia> using Turing, LinearAlgebra

julia> @model function wishart()
           theta ~ Wishart(4, Matrix{Float64}(I, 4, 4))
       end
wishart (generic function with 2 methods)

julia> Turing.setadbackend(:tracker)
┌ Warning: Usage of Tracker.jl with Turing.jl is no longer being actively tested and
│ maintained; please use at your own risk. See Zygote.jl or ReverseDiff.jl for fully
│ supported reverse-mode backends.
└ @ Turing.Essential /home/david/.julia/packages/Turing/cplDJ/src/essential/ad.jl:15
:tracker

julia> sample(wishart(), HMC(0.01, 1), 1000);
Sampling 100%|█████████████████████████████████████████████████████| Time: 0:00:06
ERROR: MethodError: no method matching Float64(::Tracker.TrackedReal{Float64})

Closest candidates are:
  (::Type{T})(::Real, ::RoundingMode) where T<:AbstractFloat
   @ Base rounding.jl:207
  (::Type{T})(::T) where T<:Number
   @ Core boot.jl:792
  (::Type{T})(::AbstractChar) where T<:Union{AbstractChar, Number}
   @ Base char.jl:50
  ...

Stacktrace:
   [1] convert(#unused#::Type{Float64}, x::Tracker.TrackedReal{Float64})
     @ Base ./number.jl:7
...

The output of ] st --manifest shows that FillArrays 1.2.0 was used.

@torfjelde
Copy link
Member

Wat..

(jl_8mpQcR) pkg> st
Status `/tmp/jl_8mpQcR/Project.toml`
  [366bfd00] DynamicPPL v0.23.0 `https://github.com/TuringLang/DynamicPPL.jl.git#master`
  [fce5fe82] Turing v0.26.0

julia> versioninfo()
Julia Version 1.9.0
Commit 8e630552924 (2023-05-07 11:25 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 12 × Intel(R) Core(TM) i7-10710U CPU @ 1.10GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, skylake)
  Threads: 1 on 12 virtual cores

julia> using Turing

julia> @model function invwishart()
           theta ~ InverseWishart(4, Matrix{Float64}(I, 4, 4))
       end
invwishart (generic function with 2 methods)

julia> using LinearAlgebra

julia> Turing.setadbackend(:tracker)
┌ Warning: Usage of Tracker.jl with Turing.jl is no longer being actively tested and maintained; please use at your own risk. See Zygote.jl or ReverseDiff.jl for fully supported reverse-mode backends.
└ @ Turing.Essential ~/.julia/packages/Turing/cplDJ/src/essential/ad.jl:15
:tracker

julia> sample(invwishart(), HMC(0.01, 1), 1000);
Sampling 100%|██████████████████████████████████████████████████████████████████████████████████████| Time: 0:00:00

@torfjelde
Copy link
Member

torfjelde commented Jun 16, 2023

AAAAAAh Wishart, not InverseWishart 🙃 That also fails on my end now 👍

@yebai
Copy link
Member

yebai commented Jun 19, 2023

I realized that we might not want to incorporate changes from the master branch. Feel free to undo my commit if needed.

@devmotion devmotion closed this Jun 19, 2023
@devmotion
Copy link
Member Author

I think this is not needed anymore since Turing fixed FillArrays to 1.0.0.

@devmotion devmotion deleted the revert-462-torfjelde/support-embedded-support branch June 19, 2023 16:46
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.

4 participants