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

Precompile fails with LoadError: Non-differentiable function mul_int #334

Open
1advaita1 opened this issue Sep 20, 2019 · 12 comments
Open

Comments

@1advaita1
Copy link

1advaita1 commented Sep 20, 2019

The following result is obtained by using Zygote and subsequently Zygote.refresh():

julia> using Zygote
ERROR: InitError: LoadError: Non-differentiable function mul_int
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] (::typeof(∂(λ)))(::Int64) at .\none:0
 [3] * at .\int.jl:54 [inlined]
 [4] (::typeof(∂(*)))(::Int64) at C:\Users\advaita\.julia\packages\Zygote\HErRu\src\compiler\interface2.jl:0
 [5] pow at C:\Users\advaita\.julia\packages\Zygote\HErRu\src\compiler\interface.jl:135 [inlined]
 [6] (::typeof(∂(Zygote.pow)))(::Int64) at C:\Users\advaita\.julia\packages\Zygote\HErRu\src\compiler\interface2.jl:0
 [7] (::getfield(Zygote, Symbol("##32#33")){typeof(∂(Zygote.pow))})(::Int64) at C:\Users\advaita\.julia\packages\Zygote\HErRu\src\compiler\interface.jl:38
 [8] gradient(::Function, ::Int64, ::Vararg{Int64,N} where N) at C:\Users\advaita\.julia\packages\Zygote\HErRu\src\compiler\interface.jl:47
 [9] top-level scope at none:0
 [10] include at .\boot.jl:317 [inlined]
 [11] include_relative(::Module, ::String) at .\loading.jl:1044
 [12] include at .\sysimg.jl:29 [inlined]
 [13] include at C:\Users\advaita\.julia\packages\Zygote\HErRu\src\Zygote.jl:1 [inlined]
 [14] precompile at C:\Users\advaita\.julia\packages\Zygote\HErRu\src\Zygote.jl:52 [inlined]
 [15] (::getfield(Zygote, Symbol("##1386#1387")))() at C:\Users\advaita\.julia\packages\Requires\9Jse8\src\init.jl:11
 [16] __init__() at C:\Users\advaita\.julia\packages\Requires\9Jse8\src\init.jl:18
 [17] _include_from_serialized(::String, ::Array{Any,1}) at .\loading.jl:633
 [18] _require_search_from_serialized(::Base.PkgId, ::String) at .\loading.jl:713
 [19] _require(::Base.PkgId) at .\loading.jl:937
 [20] require(::Base.PkgId) at .\loading.jl:858
 [21] require(::Module, ::Symbol) at .\loading.jl:853
in expression starting at C:\Users\advaita\.julia\packages\Zygote\HErRu\src\precompile.jl:10
during initialization of module Zygote

julia> using Zygote

julia>

julia> Zygote.refresh()
ERROR: LoadError: Non-differentiable function mul_int

The first time I ran it, it showed:

WARNING: could not import ZygoteRules._pullback into Zygote
WARNING: could not import ZygoteRules.pullback into Zygote
ERROR: LoadError: InitError: LoadError: Non-differentiable function mul_int

Status in Julia v1.0.4

(v1.0) pkg> st
    Status `C:\Users\advaita\.julia\environments\v1.0\Project.toml`
  [7869d1d1] IRTools v0.2.3 #master (https://github.com/MikeInnes/IRTools.jl.git)
  [e88e6eb3] Zygote v0.3.4 #master (https://github.com/FluxML/Zygote.jl.git)

The same issue exists in Julia v1.2.0

@DoktorMike
Copy link

I get the same thing using Zygote#master in julia 1.3 RC2

@simonmandlik
Copy link

simonmandlik commented Sep 26, 2019

Same here, in julia 1.1

@janEbert
Copy link

Fix by DoktorMike: ]add ZygoteRules#master

@zenna
Copy link

zenna commented Nov 4, 2019

Thanks for the fix. Currently a fresh install of both Zygote and Flux are both broken on a fresh install of Julia. Maybe some tighter compat bounds would help?

@mileslucas
Copy link

I am still unable to precompile even using ZygoteRules#master. Julia 1.2, Mac OS X Catalina, fresh Julia project.

@zenna
Copy link

zenna commented Nov 5, 2019

Are you on Zygote#master too?

@mileslucas
Copy link

mileslucas commented Nov 5, 2019

@zenna It works in a completely clean install

(test) pkg> add Zygote#master ZygoteRules#master

So I suppose that fix works. Unfortunately I don't want to use base Zygote, I want to use Turing, which encounters a variety of messy semvar restrictions. As of right now, I cannot get any version of Turing working, but that is beyond the scope of this issue.

@zenna
Copy link

zenna commented Nov 5, 2019

Yeah. I have the same issue with Flux

@racinmat
Copy link
Contributor

racinmat commented Nov 5, 2019

I just upgraded ZygoteRules to v0.2.0, and the issue happened. With ZygoteRules v0.1.0 it works fine though.

@robertfeldt
Copy link

robertfeldt commented Nov 5, 2019

Same problems here: Installing ZygoteRules#master is not enough and I cannot go with Zygote#master since there are dependency conflicts with SpecialFunctions:

(v1.2) pkg> add Zygote#master
   Cloning git-repo `https://github.com/FluxML/Zygote.jl.git`
  Updating git-repo `https://github.com/FluxML/Zygote.jl.git`
 Resolving package versions...
ERROR: Unsatisfiable requirements detected for package SpecialFunctions [276daf66]:
 SpecialFunctions [276daf66] log:
 ├─possible versions are: [0.7.0-0.7.2, 0.8.0] or uninstalled
 ├─restricted to versions 0.8.0-0.8 by Zygote [e88e6eb3], leaving only versions 0.8.0
 │ └─Zygote [e88e6eb3] log:
 │   ├─possible versions are: 0.4.0 or uninstalled
 │   └─Zygote [e88e6eb3] is fixed to version 0.4.0
 └─restricted to versions 0.7.2 by an explicit requirement — no versions left

(v1.2) pkg> add Zygote
 Resolving package versions...
  Updating `~/.julia/environments/v1.2/Project.toml`
  [e88e6eb3] + Zygote v0.3.4
  Updating `~/.julia/environments/v1.2/Manifest.toml`
 [no changes]

julia> using ZygoteRules

julia> using Zygote
[ Info: Precompiling Zygote [e88e6eb3-aa80-5325-afca-941959d7151f]
WARNING: could not import ZygoteRules._forward into Zygote
ERROR: LoadError: LoadError: Non-differentiable function mul_int
Stacktrace:
 [1] error(::String) at ./error.jl:33

@Red-Portal
Copy link

Red-Portal commented Nov 5, 2019

Find a way around. Just downgrade ZygoteRules.
At least for me, going back didn't break anything.
Maybe this will introduce an issue if you're actually using Zygote for something.

add ZygoteRules@0.1.0

I wonder if this kind of critical dependency issue will occur again in the future.
This is really critical since you simply neither roll back or go bleeding edge.

@MikeInnes
Copy link
Member

There's a PR open to fix this compat bound: JuliaRegistries/General#5065

It's less likely to happen in future because we have upper bounds on compatibility now.

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

10 participants