-
Notifications
You must be signed in to change notification settings - Fork 8
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
Zygote compatibility does not work for Julia 1.10+ #70
Comments
I confirm this issue. Have you found a workaround? |
Sorry haven't got a chance to look at the breaking changes of v1.10. It looks strange since |
@ToucheSir Could you take a look? |
@mrazomej when cross-posting issues, please link back to the original so that readers have some context. In this case, there's plenty of background in FluxML/Zygote.jl#1502. We also have a Slack discussion in the #autodiff channel about ideas to fix this. It may be that changes made in the Julia compiler need to be reverted. |
Hi all, If we want to solve this issue, we will need to put more effort into it. Then we can post an issue in Zygote. |
Hi @mBarreau , I haven't been working on this for a while due to other obligations at school, but now I'm back and willing to solve this compatibility issue. I made a little experiment and it seems that I can still get Zygote-over-TaylorDiff work by using Zygote's own rule definition tools, |
Nevertheless, it still makes sense to submit an issue to Julia base or Zygote since we want using ChainRulesCore at the end of day. So I'm working on an MWE: using Zygote
import ChainRulesCore: rrule
struct MyNumber{T}
x::T
end
function rrule(::Type{MyNumber{T}}, v::T) where T
return MyNumber{T}(v), (result) -> result.x
end
square(s::MyNumber{T}) where T = MyNumber{T}(s.x * s.x) but it didn't reproduce the issue julia> y, back = Zygote._pullback(x -> square(MyNumber(x)), 1.0)
(MyNumber{Float64}(1.0), ∂(#21)) and I don't know why... |
What about |
Fixed by c11dd72 |
Note, there has been a significant change under the hood: now |
@tansongchen and @mBarreau, I don't think this issue has been resolved; although it does not return an error in on the import Zygote
import TaylorDiff
TaylorDiff.derivative(x -> sum(x .^ 2), [1.0, 2.0, 3.0], [0.0, 1.0, 0.0], :1) # works
Zygote.withgradient([1.0, 2.0, 3.0]) do x
TaylorDiff.derivative(x -> sum(x .^ 2), x, [0.0, 1.0, 0.0], :1)
end # doesn't work, returns (val = 4.0, grad = ([0.0, 0.0, 0.0],)) Moreover, doing this with import Zygote
import TaylorDiff
import CUDA
TaylorDiff.derivative(x -> sum(x .^ 2), CUDA.cu([1.0, 2.0, 3.0]), CUDA.cu([0.0, 1.0, 0.0]), :1) # works
Zygote.withgradient(CUDA.cu([1.0, 2.0, 3.0])) do x
TaylorDiff.derivative(x -> sum(x .^ 2), x, CUDA.cu([0.0, 1.0, 0.0]), :1)
end # doesn't work, returns (val = Dual{Nothing}(4.0,2.0,12.0,0.0), grad = (nothing,)) |
I confirm that the same issue persists for Julia |
I brought up this as an issue in the
Zygote.jl
repository, but it might belong here:Zygote
fails to userrule
s defined byTaylorDiff
when run withJulia 1.10+
In
Julia 1.9.4
:In
Julia 1.10+
:The last line gives the following error:
The text was updated successfully, but these errors were encountered: