Skip to content

Conversation

yebai
Copy link
Member

@yebai yebai commented Feb 26, 2025

No description provided.

@yebai yebai requested a review from Red-Portal February 26, 2025 17:46
@Red-Portal
Copy link
Member

This looks fine for me, but the failing tests are a bit annoying. Do you want me to fix the tests first before merging this PR (and the other one as well)?

@yebai
Copy link
Member Author

yebai commented Feb 27, 2025

Do you want me to fix the tests first before merging this PR (and the other one as well)?

Yes, please

Base automatically changed from yebai-patch-1 to main March 5, 2025 22:23
@yebai yebai merged commit 4b6d8be into main Mar 5, 2025
11 of 16 checks passed
@yebai yebai deleted the yebai-patch-2 branch March 5, 2025 22:38
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Benchmark Results

Benchmark suite Current: 3b795fd Previous: a683e96 Ratio
normal/RepGradELBO + STL/meanfield/Zygote 16473872136 ns 14636863236 ns 1.13
normal/RepGradELBO + STL/meanfield/ForwardDiff 3304125733.5 ns 3350086725 ns 0.99
normal/RepGradELBO + STL/meanfield/ReverseDiff 3094818311.5 ns 3091246711 ns 1.00
normal/RepGradELBO + STL/fullrank/Zygote 16338470403 ns 14488178420 ns 1.13
normal/RepGradELBO + STL/fullrank/ForwardDiff 3688626107 ns 3684779258 ns 1.00
normal/RepGradELBO + STL/fullrank/ReverseDiff 5646882456 ns 5742736189 ns 0.98
normal/RepGradELBO/meanfield/Zygote 7530702671 ns 6910985576 ns 1.09
normal/RepGradELBO/meanfield/ForwardDiff 2353602785 ns 2459214663 ns 0.96
normal/RepGradELBO/meanfield/ReverseDiff 1313395716.5 ns 1370548995.5 ns 0.96
normal/RepGradELBO/fullrank/Zygote 7682697941 ns 6937940281 ns 1.11
normal/RepGradELBO/fullrank/ForwardDiff 2635490263.5 ns 2708551001 ns 0.97
normal/RepGradELBO/fullrank/ReverseDiff 2436281408 ns 2497588532 ns 0.98
normal + bijector/RepGradELBO + STL/meanfield/Zygote 25565717237 ns 22847036335 ns 1.12
normal + bijector/RepGradELBO + STL/meanfield/ForwardDiff 10309343356 ns 10452617328 ns 0.99
normal + bijector/RepGradELBO + STL/meanfield/ReverseDiff 4476042343 ns 4494655977 ns 1.00
normal + bijector/RepGradELBO + STL/fullrank/Zygote 25818366598 ns 23169952741 ns 1.11
normal + bijector/RepGradELBO + STL/fullrank/ForwardDiff 10786917463 ns 10972906220 ns 0.98
normal + bijector/RepGradELBO + STL/fullrank/ReverseDiff 7641622123 ns 7716647322 ns 0.99
normal + bijector/RepGradELBO/meanfield/Zygote 15735398805 ns 14557557757 ns 1.08
normal + bijector/RepGradELBO/meanfield/ForwardDiff 9335421424 ns 9793310961 ns 0.95
normal + bijector/RepGradELBO/meanfield/ReverseDiff 2541208289 ns 2569890147.5 ns 0.99
normal + bijector/RepGradELBO/fullrank/Zygote 16236341205 ns 14601467359 ns 1.11
normal + bijector/RepGradELBO/fullrank/ForwardDiff 10048414269 ns 10039535578 ns 1.00
normal + bijector/RepGradELBO/fullrank/ReverseDiff 3948466684 ns 4028716220.5 ns 0.98

This comment was automatically generated by workflow using github-action-benchmark.

@yebai
Copy link
Member Author

yebai commented Mar 6, 2025

Do you want me to fix the tests first before merging this PR (and the other one as well)?

Yes, please

Removing AbstarctOperator fixes it, but it is not clear why since abstract type constraints on keyword arguments are supported:

julia> f(x::Int;y::Real) = x,y
f (generic function with 1 method)

julia> f(1;y=2)
(1, 2)

julia> f(1;y=2.)
(1, 2.0)

julia> f(1;y="ab")
ERROR: TypeError: in keyword argument y, expected Real, got a value of type String

For future reference, here is the error message. https://github.com/TuringLang/AdvancedVI.jl/actions/runs/13550036596/job/37871165993#step:2:1021

TypeError: in keyword argument operator, expected AdvancedVI.AbstractOperator, got a value of type ClipScale{Float64}
│    Stacktrace:
│     [1] optimize(::Main.__atexample__named__repgradelbo.NormalLogNormal{Float64, Float64, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, LinearAlgebra.Diagonal{Float64, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}}}, ::RepGradELBO{ClosedFormEntropy}, ::Bijectors.MultivariateTransformed{MvLocationScale{LinearAlgebra.Diagonal{Float64, Vector{Float64}}, Distributions.Normal{Float64}, Vector{Float64}}, Bijectors.Stacked{Vector{Function}, Vector{UnitRange{Int64}}}}, ::Int64; kwargs::@Kwargs{show_progress::Bool, adtype::ADTypes.AutoForwardDiff{nothing, Nothing}, optimizer::Optimisers.Adam{Float64, Tuple{Float64, Float64}, Float64}, operator::ClipScale{Float64}, callback::typeof(Main.__atexample__named__repgradelbo.callback)})
│       @ AdvancedVI ~/work/AdvancedVI.jl/AdvancedVI.jl/src/optimize.jl:128

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