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

Weird error when loading DifferentiableFrankWolfe extension #121

Open
BatyLeo opened this issue Dec 23, 2024 · 7 comments
Open

Weird error when loading DifferentiableFrankWolfe extension #121

BatyLeo opened this issue Dec 23, 2024 · 7 comments

Comments

@BatyLeo
Copy link
Member

BatyLeo commented Dec 23, 2024

There is a weird error when loading the DifferentiableFrankWolfeExt, that does not seem to affect InferOpt other than displaying an error message.

To reproduce:

using InferOpt
using DifferentiableFrankWolfe

outputs the following error:

Precompiling ImplicitDifferentiationForwardDiffExt...
Info Given ImplicitDifferentiationForwardDiffExt was explicitly requested, output will be shown live
ERROR: LoadError: MethodError: no method matching AbstractDifferentiation.ForwardDiffBackend()
The type `AbstractDifferentiation.ForwardDiffBackend` exists, but no method is defined for this combination of argument types when trying to construct it.
Stacktrace:
  [1] forward_conditions_backend(::ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing})
    @ ImplicitDifferentiationForwardDiffExt ~/.julia/packages/ImplicitDifferentiation/gOQIS/ext/ImplicitDifferentiationForwardDiffExt.jl:62
  [2] (::ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing})(::Vector{ForwardDiff.Dual{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2}}; kwargs::@Kwargs{})
    @ ImplicitDifferentiationForwardDiffExt ~/.julia/packages/ImplicitDifferentiation/gOQIS/ext/ImplicitDifferentiationForwardDiffExt.jl:37
  [3] (::ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing})(::Vector{ForwardDiff.Dual{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2}})
    @ ImplicitDifferentiationForwardDiffExt ~/.julia/packages/ImplicitDifferentiation/gOQIS/ext/ImplicitDifferentiationForwardDiffExt.jl:27
  [4] vector_mode_dual_eval!(f::ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, cfg::ForwardDiff.JacobianConfig{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2}}}, x::Vector{Float64})
    @ ForwardDiff ~/.julia/packages/ForwardDiff/UBbGT/src/apiutils.jl:24
  [5] vector_mode_jacobian(f::ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, x::Vector{Float64}, cfg::ForwardDiff.JacobianConfig{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2}}})
    @ ForwardDiff ~/.julia/packages/ForwardDiff/UBbGT/src/jacobian.jl:129
  [6] jacobian(f::ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, x::Vector{Float64}, cfg::ForwardDiff.JacobianConfig{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2}}}, ::Val{true})
    @ ForwardDiff ~/.julia/packages/ForwardDiff/UBbGT/src/jacobian.jl:22
  [7] jacobian(f::ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, x::Vector{Float64}, cfg::ForwardDiff.JacobianConfig{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2}}})
    @ ForwardDiff ~/.julia/packages/ForwardDiff/UBbGT/src/jacobian.jl:19
  [8] jacobian(f::ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, x::Vector{Float64})
    @ ForwardDiff ~/.julia/packages/ForwardDiff/UBbGT/src/jacobian.jl:19
  [9] macro expansion
    @ ~/.julia/packages/ImplicitDifferentiation/gOQIS/ext/ImplicitDifferentiationForwardDiffExt.jl:78 [inlined]
 [10] macro expansion
    @ ~/.julia/packages/PrecompileTools/L8A3n/src/workloads.jl:78 [inlined]
 [11] top-level scope
    @ ~/.julia/packages/ImplicitDifferentiation/gOQIS/ext/ImplicitDifferentiationForwardDiffExt.jl:71
 [12] include
    @ ./Base.jl:557 [inlined]
 [13] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
    @ Base ./loading.jl:2790
 [14] top-level scope
    @ stdin:5
in expression starting at /Users/taleboy/.julia/packages/ImplicitDifferentiation/gOQIS/ext/ImplicitDifferentiationForwardDiffExt.jl:1
in expression starting at stdin:5
  ✗ ImplicitDifferentiation  ImplicitDifferentiationForwardDiffExt
  0 dependencies successfully precompiled in 3 seconds. 65 already precompiled.
[ Info: Precompiling ImplicitDifferentiationForwardDiffExt [5d5c0af3-0a85-5199-b335-e133c52d08ae] (cache misses: wrong dep version loaded (4), dep missing source (2), mismatched flags (4))
ERROR: LoadError: MethodError: no method matching AbstractDifferentiation.ForwardDiffBackend()
The type `AbstractDifferentiation.ForwardDiffBackend` exists, but no method is defined for this combination of argument types when trying to construct it.
Stacktrace:
  [1] forward_conditions_backend(::ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing})
    @ ImplicitDifferentiationForwardDiffExt ~/.julia/packages/ImplicitDifferentiation/gOQIS/ext/ImplicitDifferentiationForwardDiffExt.jl:62
  [2] (::ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing})(::Vector{ForwardDiff.Dual{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2}}; kwargs::@Kwargs{})
    @ ImplicitDifferentiationForwardDiffExt ~/.julia/packages/ImplicitDifferentiation/gOQIS/ext/ImplicitDifferentiationForwardDiffExt.jl:37
  [3] (::ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing})(::Vector{ForwardDiff.Dual{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2}})
    @ ImplicitDifferentiationForwardDiffExt ~/.julia/packages/ImplicitDifferentiation/gOQIS/ext/ImplicitDifferentiationForwardDiffExt.jl:27
  [4] vector_mode_dual_eval!(f::ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, cfg::ForwardDiff.JacobianConfig{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2}}}, x::Vector{Float64})
    @ ForwardDiff ~/.julia/packages/ForwardDiff/UBbGT/src/apiutils.jl:24
  [5] vector_mode_jacobian(f::ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, x::Vector{Float64}, cfg::ForwardDiff.JacobianConfig{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2}}})
    @ ForwardDiff ~/.julia/packages/ForwardDiff/UBbGT/src/jacobian.jl:129
  [6] jacobian(f::ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, x::Vector{Float64}, cfg::ForwardDiff.JacobianConfig{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2}}}, ::Val{true})
    @ ForwardDiff ~/.julia/packages/ForwardDiff/UBbGT/src/jacobian.jl:22
  [7] jacobian(f::ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, x::Vector{Float64}, cfg::ForwardDiff.JacobianConfig{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2, Vector{ForwardDiff.Dual{ForwardDiff.Tag{ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, Float64}, Float64, 2}}})
    @ ForwardDiff ~/.julia/packages/ForwardDiff/UBbGT/src/jacobian.jl:19
  [8] jacobian(f::ImplicitDifferentiation.ImplicitFunction{ImplicitDifferentiationForwardDiffExt.var"#forward#8", ImplicitDifferentiationForwardDiffExt.var"#conditions#9", ImplicitDifferentiation.DirectLinearSolver, Nothing}, x::Vector{Float64})
    @ ForwardDiff ~/.julia/packages/ForwardDiff/UBbGT/src/jacobian.jl:19
  [9] macro expansion
    @ ~/.julia/packages/ImplicitDifferentiation/gOQIS/ext/ImplicitDifferentiationForwardDiffExt.jl:78 [inlined]
 [10] macro expansion
    @ ~/.julia/packages/PrecompileTools/L8A3n/src/workloads.jl:78 [inlined]
 [11] top-level scope
    @ ~/.julia/packages/ImplicitDifferentiation/gOQIS/ext/ImplicitDifferentiationForwardDiffExt.jl:71
 [12] include
    @ ./Base.jl:557 [inlined]
 [13] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
    @ Base ./loading.jl:2790
 [14] top-level scope
    @ stdin:5
in expression starting at /Users/taleboy/.julia/packages/ImplicitDifferentiation/gOQIS/ext/ImplicitDifferentiationForwardDiffExt.jl:1
in expression starting at stdin:5
┌ Error: Error during loading of extension ImplicitDifferentiationForwardDiffExt of ImplicitDifferentiation, use `Base.retry_load_extensions()` to retry.
│   exception =1-element ExceptionStack:
│    Failed to precompile ImplicitDifferentiationForwardDiffExt [5d5c0af3-0a85-5199-b335-e133c52d08ae] to "/Users/taleboy/.julia/compiled/v1.11/ImplicitDifferentiationForwardDiffExt/jl_hlfsLf".
│    Stacktrace:
│      [1] error(s::String)
│        @ Base ./error.jl:35
│      [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool; flags::Cmd, cacheflags::Base.CacheFlags, reasons::Dict{String, Int64}, isext::Bool)
│        @ Base ./loading.jl:3085
│      [3] (::Base.var"#1082#1083"{Base.PkgId})()
│        @ Base ./loading.jl:2492
│      [4] mkpidlock(f::Base.var"#1082#1083"{Base.PkgId}, at::String, pid::Int32; kwopts::@Kwargs{stale_age::Int64, wait::Bool})
│        @ FileWatching.Pidfile /Applications/Julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/FileWatching/src/pidfile.jl:95
│      [5] #mkpidlock#6
│        @ /Applications/Julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/FileWatching/src/pidfile.jl:90 [inlined]
│      [6] trymkpidlock(::Function, ::Vararg{Any}; kwargs::@Kwargs{stale_age::Int64})
│        @ FileWatching.Pidfile /Applications/Julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/FileWatching/src/pidfile.jl:116
│      [7] #invokelatest#2
│        @ ./essentials.jl:1057 [inlined]
│      [8] invokelatest
│        @ ./essentials.jl:1052 [inlined]
│      [9] maybe_cachefile_lock(f::Base.var"#1082#1083"{Base.PkgId}, pkg::Base.PkgId, srcpath::String; stale_age::Int64)
│        @ Base ./loading.jl:3609
│     [10] maybe_cachefile_lock
│        @ ./loading.jl:3606 [inlined]
│     [11] _require(pkg::Base.PkgId, env::Nothing)
│        @ Base ./loading.jl:2488
│     [12] __require_prelocked(uuidkey::Base.PkgId, env::Nothing)
│        @ Base ./loading.jl:2315
│     [13] #invoke_in_world#3
│        @ ./essentials.jl:1089 [inlined]
│     [14] invoke_in_world
│        @ ./essentials.jl:1086 [inlined]
│     [15] _require_prelocked
│        @ ./loading.jl:2302 [inlined]
│     [16] _require_prelocked
│        @ ./loading.jl:2301 [inlined]
│     [17] run_extension_callbacks(extid::Base.ExtensionId)
│        @ Base ./loading.jl:1500
│     [18] #1068
│        @ ./loading.jl:1557 [inlined]
│     [19] filter!(f::Base.var"#1068#1069", a::Vector{Base.ExtensionId})
│        @ Base ./array.jl:2910
│     [20] macro expansion
│        @ ./loading.jl:1556 [inlined]
│     [21] macro expansion
│        @ ./lock.jl:273 [inlined]
│     [22] retry_load_extensions()
│        @ Base ./loading.jl:1551
│     [23] top-level scope
│        @ REPL[16]:1
│     [24] eval
│        @ ./boot.jl:430 [inlined]
│     [25] eval_user_input(ast::Any, backend::REPL.REPLBackend, mod::Module)
│        @ REPL /Applications/Julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/REPL/src/REPL.jl:245
│     [26] repl_backend_loop(backend::REPL.REPLBackend, get_module::Function)
│        @ REPL /Applications/Julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/REPL/src/REPL.jl:342
│     [27] start_repl_backend(backend::REPL.REPLBackend, consumer::Any; get_module::Function)
│        @ REPL /Applications/Julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/REPL/src/REPL.jl:327
│     [28] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool, backend::Any)
│        @ REPL /Applications/Julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/REPL/src/REPL.jl:483
│     [29] run_repl(repl::REPL.AbstractREPL, consumer::Any)
│        @ REPL /Applications/Julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/REPL/src/REPL.jl:469
│     [30] (::Base.var"#1139#1141"{Bool, Symbol, Bool})(REPL::Module)
│        @ Base ./client.jl:446
│     [31] #invokelatest#2
│        @ ./essentials.jl:1055 [inlined]
│     [32] invokelatest
│        @ ./essentials.jl:1052 [inlined]
│     [33] run_main_repl(interactive::Bool, quiet::Bool, banner::Symbol, history_file::Bool, color_set::Bool)
│        @ Base ./client.jl:430
│     [34] repl_main
│        @ ./client.jl:567 [inlined]
│     [35] _start()
│        @ Base ./client.jl:541
└ @ Base loading.jl:1506

then the extension seems to still work, at least tests still succeed.
It seems the extension of a downstream package (ImplicitDifferentiationForwardDiffExt) fails but does not directly affect InferOpt, although it displays a terrifying error message.
Seems related to the interaction between ImplicitDifferentiation and the new AbstractDifferentiation.
There is also a similar error (from ImplicitDifferentiationZygoteExt) when loading Zygote afterwards.

@gdalle do you have any insights ?

@gdalle
Copy link
Member

gdalle commented Dec 23, 2024

That's because DifferentiableFrankWolfe v0.3, which uses a new version of ImplicitDifferentiation (switching from AbstractDifferentiation to DifferentiationInterface) was ready but not released. I triggered registration, once it's done InferOpt is due for a compat bump

@BatyLeo BatyLeo linked a pull request Dec 24, 2024 that will close this issue
@BatyLeo
Copy link
Member Author

BatyLeo commented Dec 24, 2024

I tried updating to DifferentiableFrankWolfe v0.3.
It seems to solve the issue, however IterativeLinearSolver is no longer reexported from ImplicitDifferentiation.jl, and currently needed in InferOpt here:

implicit_kwargs = (; linear_solver=IterativeLinearSolver(; accept_inconsistent=true))

Same for LinearMinimizationOracle from FrankWolfe.jl.

@gdalle
Copy link
Member

gdalle commented Dec 25, 2024

The default solver for ImplicitDifferentiation.jl is now called KrylovLinearSolver. As for the LMO, it was bad practice re-exporting it, we should get it directly from FrankWolfe.jl

@BatyLeo
Copy link
Member Author

BatyLeo commented Dec 25, 2024

Should we then add FrankWolfe and ImplicitDifferentiation as (weak)dependencies, how does this work?

@gdalle
Copy link
Member

gdalle commented Dec 25, 2024

Just make a list of packages in the extensions section of the Project instead of a single name.

InferOptFrankWolfeExt = ["DifferentiableFrankWolfe", "FrankWolfe", "ImplicitDifferentiation"]

A bit more cumbersome for users, but hey, there are no users

@BatyLeo
Copy link
Member Author

BatyLeo commented Dec 25, 2024

Ok, I tried to update all this, I have an issue in the paths tests.
It seems that something fails when $\theta$ is a matrix (no method matching (::ImplicitDifferentiation.ImplicitFunction)(Matrix{Float32}, ...), closest candidates are (::ImplicitDifferentiation.ImplicitFunction)(!Matched::AbstractVector, Any...; kwargs...) and (::ImplicitDifferentiation.ImplicitFunction)(!Matched::AbstractArray{ForwardDiff.Dual{T, R, N}, 1}, Any...; kwargs...) where {T, R, N}).
The same tests on ranking with $\theta$ a vector seem to work.
Not sure if something is missing from ImplicitDifferentiation or if this can be fixed on our side.

@gdalle
Copy link
Member

gdalle commented Dec 25, 2024

Yes, the new version of ImplicitDifferentiation only accepts vectors, since higher-order tensors are flattened into vectors anyway. So we need a manual resize on the InferOpt side

@BatyLeo BatyLeo removed a link to a pull request Dec 25, 2024
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

No branches or pull requests

2 participants