Skip to content

fix avoid re-defining the differentiation objective to support AD pre-compilation #27

fix avoid re-defining the differentiation objective to support AD pre-compilation

fix avoid re-defining the differentiation objective to support AD pre-compilation #27

Triggered via pull request June 13, 2024 21:48
Status Success
Total duration 5m 20s
Artifacts

Documentation.yml

on: pull_request
Fit to window
Zoom out
Zoom in

Annotations

10 warnings
build: ../../../.julia/packages/Documenter/bYYzK/src/Utilities/Utilities.jl#L34
failed to run `@setup` block in src/elbo/repgradelbo.md ```@setup repgradelbo max_iter = 3*10^3 function callback(; stat, state, params, restructure, gradient) q = restructure(params).dist dist2 = sum(abs2, q.location - vcat([μ_x], μ_y)) + sum(abs2, diag(q.scale) - vcat(σ_x, σ_y)) (dist = sqrt(dist2),) end _, stats_cfe, _ = AdvancedVI.optimize( model, cfe, q0_trans, max_iter; show_progress = false, adtype = AutoForwardDiff(), optimizer = Optimisers.Adam(3e-3), callback = callback, ); _, stats_stl, _ = AdvancedVI.optimize( model, repgradelbo, q0_trans, max_iter; show_progress = false, adtype = AutoForwardDiff(), optimizer = Optimisers.Adam(3e-3), callback = callback, ); t = [stat.iteration for stat in stats_cfe] elbo_cfe = [stat.elbo for stat in stats_cfe] elbo_stl = [stat.elbo for stat in stats_stl] dist_cfe = [stat.dist for stat in stats_cfe] dist_stl = [stat.dist for stat in stats_stl] plot( t, elbo_cfe, label="BBVI CFE", xlabel="Iteration", ylabel="ELBO") plot!(t, elbo_stl, label="BBVI STL", xlabel="Iteration", ylabel="ELBO") savefig("advi_stl_elbo.svg") plot( t, dist_cfe, label="BBVI CFE", xlabel="Iteration", ylabel="distance to optimum", yscale=:log10) plot!(t, dist_stl, label="BBVI STL", xlabel="Iteration", ylabel="distance to optimum", yscale=:log10) savefig("advi_stl_dist.svg") nothing ``` exception = LoadError: MethodError: no method matching iterate(::Bijectors.MultivariateTransformed{MvLocationScale{LinearAlgebra.Diagonal{ForwardDiff.Dual{ForwardDiff.Tag{AdvancedVI.var"#obj_integrand#6"{Random.TaskLocalRNG, RepGradELBO{ClosedFormEntropy}, Vector{Float64}, Optimisers.Restructure{Bijectors.MultivariateTransformed{MvLocationScale{LinearAlgebra.Diagonal{Float64, Vector{Float64}}, Distributions.Normal{Float64}, Vector{Float64}, Float64}, Bijectors.Stacked{Vector{Function}, Vector{UnitRange{Int64}}}}, @NamedTuple{dist::@NamedTuple{location::Int64, scale::Int64}, transform::@NamedTuple{bs::Vector{Any}}}}}, Float64}, Float64, 12}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{AdvancedVI.var"#obj_integrand#6"{Random.TaskLocalRNG, RepGradELBO{ClosedFormEntropy}, Vector{Float64}, Optimisers.Restructure{Bijectors.MultivariateTransformed{MvLocationScale{LinearAlgebra.Diagonal{Float64, Vector{Float64}}, Distributions.Normal{Float64}, Vector{Float64}, Float64}, Bijectors.Stacked{Vector{Function}, Vector{UnitRange{Int64}}}}, @NamedTuple{dist::@NamedTuple{location::Int64, scale::Int64}, transform::@NamedTuple{bs::Vector{Any}}}}}, Float64}, Float64, 12}}}, Distributions.Normal{Float64}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{AdvancedVI.var"#obj_integrand#6"{Random.TaskLocalRNG, RepGradELBO{ClosedFormEntropy}, Vector{Float64}, Optimisers.Restructure{Bijectors.MultivariateTransformed{MvLocationScale{LinearAlgebra.Diagonal{Float64, Vector{Float64}}, Distributions.Normal{Float64}, Vector{Float64}, Float64}, Bijectors.Stacked{Vector{Function}, Vector{UnitRange{Int64}}}}, @NamedTuple{dist::@NamedTuple{location::Int64, scale::Int64}, transform::@NamedTuple{bs::Vector{Any}}}}}, Float64}, Float64, 12}}, Float64}, Bijectors.Stacked{Vector{Function}, Vector{UnitRange{Int64}}}}) Closest candidates are: iterate(!Matched::DataStructures.IntSet) @ DataStructures ~/.julia/packages/DataStructures/95DJa/src/int_set.jl:171 iterate(!Matched::DataStructures.IntSet, !Matched::Int64) @ DataStructures ~/.julia/packages/DataStructures/95DJa/src/int_set.jl:173 iterate(!Matched::DataStructures.IntSet, !Matched::Int64, !Matched::Any) @ DataStructures ~/.julia/packages/DataStructures/95DJa/src/int_set.jl:173 ... in expression starting at string:8
build: ../../../.julia/packages/Documenter/bYYzK/src/Utilities/Utilities.jl#L34
failed to run `@setup` block in src/elbo/repgradelbo.md ```@setup repgradelbo repgradelbo = AdvancedVI.RepGradELBO(n_montecarlo); _, stats_qmc, _ = AdvancedVI.optimize( model, repgradelbo, q0_trans, max_iter; show_progress = false, adtype = AutoForwardDiff(), optimizer = Optimisers.Adam(3e-3), callback = callback, ); t = [stat.iteration for stat in stats_qmc] elbo_qmc = [stat.elbo for stat in stats_qmc] dist_qmc = [stat.dist for stat in stats_qmc] plot( t, elbo_cfe, label="BBVI CFE", xlabel="Iteration", ylabel="ELBO") plot!(t, elbo_qmc, label="BBVI CFE QMC", xlabel="Iteration", ylabel="ELBO") savefig("advi_qmc_elbo.svg") plot( t, dist_cfe, label="BBVI CFE", xlabel="Iteration", ylabel="distance to optimum", yscale=:log10) plot!(t, dist_qmc, label="BBVI CFE QMC", xlabel="Iteration", ylabel="distance to optimum", yscale=:log10) savefig("advi_qmc_dist.svg") # The following definition is necessary to revert the behavior of `rand` so that # the example in example.md works with the regular non-QMC estimator. function Distributions.rand( rng::AbstractRNG, q::MvLocationScale{<:Diagonal, D, L}, num_samples::Int ) where {L, D} @unpack location, scale, dist = q n_dims = length(location) scale_diag = diag(scale) scale_diag.*rand(rng, dist, n_dims, num_samples) .+ location end nothing ``` exception = LoadError: MethodError: no method matching iterate(::Bijectors.MultivariateTransformed{MvLocationScale{LinearAlgebra.Diagonal{ForwardDiff.Dual{ForwardDiff.Tag{AdvancedVI.var"#obj_integrand#6"{Random.TaskLocalRNG, RepGradELBO{ClosedFormEntropy}, Vector{Float64}, Optimisers.Restructure{Bijectors.MultivariateTransformed{MvLocationScale{LinearAlgebra.Diagonal{Float64, Vector{Float64}}, Distributions.Normal{Float64}, Vector{Float64}, Float64}, Bijectors.Stacked{Vector{Function}, Vector{UnitRange{Int64}}}}, @NamedTuple{dist::@NamedTuple{location::Int64, scale::Int64}, transform::@NamedTuple{bs::Vector{Any}}}}}, Float64}, Float64, 12}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{AdvancedVI.var"#obj_integrand#6"{Random.TaskLocalRNG, RepGradELBO{ClosedFormEntropy}, Vector{Float64}, Optimisers.Restructure{Bijectors.MultivariateTransformed{MvLocationScale{LinearAlgebra.Diagonal{Float64, Vector{Float64}}, Distributions.Normal{Float64}, Vector{Float64}, Float64}, Bijectors.Stacked{Vector{Function}, Vector{UnitRange{Int64}}}}, @NamedTuple{dist::@NamedTuple{location::Int64, scale::Int64}, transform::@NamedTuple{bs::Vector{Any}}}}}, Float64}, Float64, 12}}}, Distributions.Normal{Float64}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{AdvancedVI.var"#obj_integrand#6"{Random.TaskLocalRNG, RepGradELBO{ClosedFormEntropy}, Vector{Float64}, Optimisers.Restructure{Bijectors.MultivariateTransformed{MvLocationScale{LinearAlgebra.Diagonal{Float64, Vector{Float64}}, Distributions.Normal{Float64}, Vector{Float64}, Float64}, Bijectors.Stacked{Vector{Function}, Vector{UnitRange{Int64}}}}, @NamedTuple{dist::@NamedTuple{location::Int64, scale::Int64}, transform::@NamedTuple{bs::Vector{Any}}}}}, Float64}, Float64, 12}}, Float64}, Bijectors.Stacked{Vector{Function}, Vector{UnitRange{Int64}}}}) Closest candidates are: iterate(!Matched::DataStructures.IntSet) @ DataStructures ~/.julia/packages/DataStructures/95DJa/src/int_set.jl:171 iterate(!Matched::DataStructures.IntSet, !Matched::Int64) @ DataStructures ~/.julia/packages/DataStructures/95DJa/src/int_set.jl:173 iterate(!Matched::DataStructures.IntSet, !Matched::Int64, !Matched::Any) @ DataStructures ~/.julia/packages/DataStructures/95DJa/src/int_set.jl:173 ... in expression starting at string:1
build: ../../../.julia/packages/Documenter/bYYzK/src/Utilities/Utilities.jl#L34
failed to run `@example` block in src/examples.md:97-109 ```@example elboexample n_max_iter = 10^4 q_trans, stats, _ = AdvancedVI.optimize( model, objective, q0_trans, n_max_iter; show_progress = false, adtype = AutoForwardDiff(), optimizer = Optimisers.Adam(1e-3) ); nothing ``` value = ArgumentError: 10 is not a power of 2
build: ../../../.julia/packages/Documenter/bYYzK/src/Utilities/Utilities.jl#L34
failed to run `@example` block in src/examples.md:113-121 ```@example elboexample using Plots t = [stat.iteration for stat ∈ stats] y = [stat.elbo for stat ∈ stats] plot(t, y, label="BBVI", xlabel="Iteration", ylabel="ELBO") savefig("bbvi_example_elbo.svg") nothing ``` value = UndefVarError: `stats` not defined
build: ../../../.julia/packages/Documenter/bYYzK/src/Utilities/Utilities.jl#L34
failed to run `@example` block in src/examples.md:127-129 ```@example elboexample estimate_objective(objective, q_trans, model; n_samples=10^4) ``` value = UndefVarError: `q_trans` not defined
build: ../../../.julia/packages/Documenter/bYYzK/src/Utilities/Utilities.jl#L34
4 docstrings not included in the manual: AdvancedVI.update_variational_params! AdvancedVI.ClosedFormEntropy AdvancedVI.estimate_entropy AdvancedVI.value_and_gradient! These are docstrings in the checked modules (configured with the modules keyword) that are not included in @docs or @autodocs blocks.
build: ../../../.julia/packages/Documenter/bYYzK/src/Writers/HTMLWriter.jl#L2103
invalid local image: unresolved path in examples.md link = "bbvi_example_elbo.svg"
build: ../../../.julia/packages/Documenter/bYYzK/src/Writers/HTMLWriter.jl#L2081
invalid local link: unresolved path in elbo/repgradelbo.md link.text = 1-element Vector{Any}: Markdown.Code("", "Bijectors") link.url = ""
build: ../../../.julia/packages/Documenter/bYYzK/src/Writers/HTMLWriter.jl#L2103
invalid local image: unresolved path in elbo/repgradelbo.md link = "advi_stl_elbo.svg"
build: ../../../.julia/packages/Documenter/bYYzK/src/Writers/HTMLWriter.jl#L2103
invalid local image: unresolved path in elbo/repgradelbo.md link = "advi_stl_dist.svg"