-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
Julia 0.7 #269
Conversation
Can start with the update for 0.7. Tagging will be any day now. |
For broadcasting see JuliaAttic/TakingBroadcastSeriously.jl#8 - in Julia 0.7 overloading it became much easier. |
It's a bit more complex than that for us, because we don't actually want to un-fuse broadcasts, and in fact 0.6 was simpler in this case. We have to inject dual numbers into the leaves of the |
I think you can use |
da8d113
to
7b44adb
Compare
Yeah, doing that works for broadcast as long as we're happy to force fusion; though it's hard to imagine where that would be an issue. @gustafsson would you be able to look at how we overload |
17b3313
to
14c870a
Compare
fs = fs == nothing ? [] : [:($(map(QuoteNode, fs.args)...),)] | ||
:(treelike(@__MODULE__, $(esc(T)), $(fs...))) | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your macro-fu is second to none, but isn't the @__MODULE__
stuff only needed because of your original strategy of making a function that uses @eval
to behave kind of like a macro? Could you accomplish the same thing with just a macro and leave the treelike
function only for the deprecation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good thought, and it'd work when the fields are explicitly provided, but otherwise we want to do fieldnames(T)
where T
is a type, rather than a symbol. So we have to go through at least one round of eval
here.
The MNIST example in ModelZoo is broken on .7 branch.
Note that only occurs in the using Flux, Flux.Data.MNIST
using Flux: onehotbatch, argmax, crossentropy, throttle
using Base.Iterators: repeated
# using CuArrays
# Classify MNIST digits with a simple multi-layer-perceptron
imgs = MNIST.images()[1:100]
# Stack images into one large batch
X = hcat(float.(reshape.(imgs, :))...) |> gpu
labels = MNIST.labels()[1:100]
# One-hot-encode the labels
Y = onehotbatch(labels, 0:9) |> gpu
m = Chain(
Dense(28^2, 32, relu),
Dense(32, 10),
softmax) |> gpu
loss(x, y) = crossentropy(m(x), y)
Flux.back!(loss(X, Y)) |
Woot woot: Test Summary: | Pass Total
Flux | 313 313
Testing Flux tests passed I run into some annoying issue with Gzip, though. Makes gzip (and so Flux) pretty flaky. I'm a bit confused by all the names (gzip, zlib, libz), but could https://github.com/bicycle1885/CodecZlib.jl be a replacement for Gzip? It uses that sweet BinaryProvider sauce ;) |
I think I tried that at some point and didn't use it for some reason. Can't remember now though. If it's an issue I'm happy to switch over. |
… array.jl still need to be updated. As a result, some more tests may not pass for the time being
Julia 0.7 fixes
Just a heads up, on macOS 10.13.6 and Julia v0.7 I get: julia> import Flux
[ Info: Precompiling Flux [587475ba-b771-5e3f-ad9e-33799f191a9c]
ERROR: LoadError: LoadError: error compiling top-level scope: could not load library "libz"
dlopen(libz.dylib, 1): image not found |
You can try this out with
add Flux#julia-0.7
.NNlib branchAbstractTrees#master (Tagged release for 0.7 JuliaCollections/AbstractTrees.jl#17)CuArrays also needs updates, but Flux itself will work fine without that for now.