Flux: The Julia Machine Learning Library
Flux is a machine learning library for Julia. It gives you layers, losses and training tools that you can compose with your own Julia code.
- Train your first neural network with the Flux quick start.
- Compile training and inference with Reactant on CPU and supported accelerators. For training, Flux compiles the forward pass, gradient calculation and optimiser update together.
- Load pretrained models with Metalhead.jl for vision, language and image generation.
Installation
Download Julia 1.10 or later, preferably the current stable release. You can add Flux using Julia's package manager by typing ] add Flux in the Julia prompt. For hardware-specific setup, see the GPU guide.
Learning Flux
The guide introduces Flux from scratch, starting with fitting a line. It covers how to define models, compute gradients and write training loops.
The tutorials walk through specific tasks. For complete training scripts, see Models and Examples. For libraries that work with Flux, see the ecosystem page.
The reference section includes, beside Flux's own functions, those of some companion packages: Zygote.jl (automatic differentiation), Optimisers.jl (training) and others.
Community
Everyone is welcome to join our community on the Julia discourse forum, or the slack chat (channel #machine-learning). If you have questions or issues we'll try to help you out.
If you're interested in hacking on Flux, the source code is open and easy to understand – it's all just the same Julia code you work with normally. You might be interested in our intro issues to get started, or our contributing guide.