Skip to content

Commit 815deaa

Browse files
mcabbottToucheSir
andauthored
Move doc sections to "guide" + "reference" (#2115)
* make guide + reference * try moving Fitting a Line to tutorials * restore Fitting a Line's place * remove duplicate functor docstring (it's in Functors section) * alter "Learning Flux" section to match * reduce the amount of text on welcome page * add a CUDA.jl reference page * add Alternatives to Flux section * fixup * hide some tutorials, try moving Ecosystem up * remove the 📚 marker * tweaks to links page * trim even more surplus text from welcome page * rm CUDA page * the welcome page is short enough not to need navigation, and using H3 saves space on the navigation panel so you can see more other things * fix misleading sentence in nnlib intro * remove CUDA * Apply 2 suggestions Co-authored-by: Brian Chen <[email protected]> * Update docs/src/index.md * add terminology note * remove example functions from headings * fixup Co-authored-by: Brian Chen <[email protected]>
1 parent fc88e4f commit 815deaa

File tree

7 files changed

+78
-58
lines changed

7 files changed

+78
-58
lines changed

Diff for: docs/make.jl

+34-32
Original file line numberDiff line numberDiff line change
@@ -9,51 +9,53 @@ makedocs(
99
sitename = "Flux",
1010
# strict = [:cross_references,],
1111
pages = [
12-
"Getting Started" => [
13-
"Welcome" => "index.md",
12+
"Welcome" => "index.md",
13+
"Guide" => [
14+
# You could read this end-to-end, or skip to what you need.
15+
# Aim is to cover each new concept exactly once (but not list all variants).
16+
# Hard to invent further divisions which aren't more confusing than helpful?
1417
"Quick Start" => "models/quickstart.md",
1518
"Fitting a Line" => "models/overview.md",
1619
"Gradients and Layers" => "models/basics.md",
17-
],
18-
"Building Models" => [
19-
"Built-in Layers 📚" => "models/layers.md",
20+
"Training" => "training/training.md",
21+
"Regularisation" => "models/regularisation.md", # consolidated in #2114
2022
"Recurrence" => "models/recurrence.md",
21-
"Activation Functions 📚" => "models/activation.md",
22-
"NNlib.jl 📚 (`softmax`, `conv`, ...)" => "models/nnlib.md",
23-
],
24-
"Handling Data" => [
25-
"MLUtils.jl 📚 (`DataLoader`, ...)" => "data/mlutils.md",
26-
"OneHotArrays.jl 📚 (`onehot`, ...)" => "data/onehot.md",
27-
],
28-
"Training Models" => [
29-
"Training" => "training/training.md",
30-
"Regularisation" => "models/regularisation.md",
31-
"Loss Functions 📚" => "models/losses.md",
32-
"Optimisation Rules 📚" => "training/optimisers.md", # TODO move optimiser intro up to Training
33-
"Callback Helpers 📚" => "training/callbacks.md",
34-
"Zygote.jl 📚 (`gradient`, ...)" => "training/zygote.md",
35-
],
36-
"Model Tools" => [
37-
"GPU Support" => "gpu.md",
38-
"Saving & Loading" => "saving.md",
39-
"Shape Inference 📚" => "outputsize.md",
40-
"Weight Initialisation 📚" => "utilities.md",
41-
"Flat vs. Nested 📚" => "destructure.md",
42-
"Functors.jl 📚 (`fmap`, ...)" => "models/functors.md",
23+
"GPU Support" => "gpu.md",
24+
"Saving & Loading" => "saving.md",
25+
"Performance Tips" => "performance.md",
26+
],
27+
"Ecosystem" => "ecosystem.md",
28+
"Reference" => [
29+
# This essentially collects docstrings, with a bit of introduction.
30+
"Built-in Layers" => "models/layers.md",
31+
"Activation Functions" => "models/activation.md",
32+
"Weight Initialisation" => "utilities.md",
33+
"Loss Functions" => "models/losses.md",
34+
"Optimisation Rules" => "training/optimisers.md", # TODO move optimiser intro up to Training
35+
"Shape Inference" => "outputsize.md",
36+
"Flat vs. Nested" => "destructure.md",
37+
"Callback Helpers" => "training/callbacks.md",
38+
"Gradients -- Zygote.jl" => "training/zygote.md",
39+
"Batching Data -- MLUtils.jl" => "data/mlutils.md",
40+
"OneHotArrays.jl" => "data/onehot.md",
41+
"Low-level Operations -- NNlib.jl" => "models/nnlib.md",
42+
"Nested Structures -- Functors.jl" => "models/functors.md",
4343
],
44-
"Tutorials" => [
45-
# Roughly in order of increasing complexity? Not chronological.
44+
"Tutorials" => [
45+
# These walk you through various tasks. It's fine if they overlap quite a lot.
46+
# All the website tutorials can move here, perhaps much of the model zoo too?
47+
# Or perhaps those should just be trashed, model zoo versions are newer & more useful.
4648
"Linear Regression" => "tutorials/linear_regression.md",
49+
#=
4750
"Julia & Flux: 60 Minute Blitz" => "tutorials/2020-09-15-deep-learning-flux.md",
4851
"Multi-layer Perceptron" => "tutorials/2021-01-26-mlp.md",
4952
"Simple ConvNet" => "tutorials/2021-02-07-convnet.md",
5053
"Generative Adversarial Net" => "tutorials/2021-10-14-vanilla-gan.md",
5154
"Deep Convolutional GAN" => "tutorials/2021-10-08-dcgan-mnist.md",
55+
=#
5256
# Not really sure where this belongs... some in Fluxperimental, aim to delete?
5357
"Custom Layers" => "models/advanced.md", # TODO move freezing to Training
54-
],
55-
"Performance Tips" => "performance.md",
56-
"Flux's Ecosystem" => "ecosystem.md",
58+
],
5759
],
5860
format = Documenter.HTML(
5961
sidebar_sitename = false,

Diff for: docs/src/ecosystem.md

+28-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ globally providing a rich and consistent user experience.
55

66
This is a non-exhaustive list of Julia packages, nicely complementing `Flux` in typical
77
machine learning and deep learning workflows. To add your project please send a [PR](https://github.com/FluxML/Flux.jl/pulls).
8-
See also academic work citing Flux or Zygote.
8+
See also academic work [citing Flux](https://scholar.google.com/scholar?cites=9731162218836700005&hl=en) or [citing Zygote](https://scholar.google.com/scholar?cites=11943854577624257878&hl=en).
99

1010
## Flux models
1111

12-
Packages that are actual `Flux` models but are not available directly through the `Flux` package.
12+
- Flux's [model-zoo](https://github.com/FluxML/model-zoo) contains examples from many domains.
1313

1414
### Computer vision
1515

@@ -38,6 +38,8 @@ Packages that are actual `Flux` models but are not available directly through th
3838

3939
- [FluxArchitectures.jl](https://github.com/sdobber/FluxArchitectures.jl) is a collection of advanced network architectures for time series forecasting.
4040

41+
---
42+
4143
## Tools closely associated with Flux
4244

4345
Utility tools you're unlikely to have met if you never used Flux!
@@ -64,9 +66,10 @@ Tools to put data into the right order for creating a model.
6466

6567
### Parameters
6668

67-
- [Parameters.jl](https://github.com/mauro3/Parameters.jl) types with default field values, keyword constructors and (un-)pack macros.
6869
- [ParameterSchedulers.jl](https://github.com/darsnack/ParameterSchedulers.jl) standard scheduling policies for machine learning.
6970

71+
---
72+
7073
## Differentiable programming
7174

7275
Packages based on differentiable programming but not necessarily related to Machine Learning.
@@ -90,6 +93,7 @@ Packages based on differentiable programming but not necessarily related to Mach
9093

9194
- [OnlineStats.jl](https://github.com/joshday/OnlineStats.jl) provides single-pass algorithms for statistics.
9295

96+
---
9397

9498
## Useful miscellaneous packages
9599

@@ -104,8 +108,29 @@ Some useful and random packages!
104108
- [ProgressMeter.jl](https://github.com/timholy/ProgressMeter.jl) progress meters for long-running computations.
105109
- [TensorBoardLogger.jl](https://github.com/PhilipVinc/TensorBoardLogger.jl) easy peasy logging to [tensorboard](https://www.tensorflow.org/tensorboard) in Julia
106110
- [ArgParse.jl](https://github.com/carlobaldassi/ArgParse.jl) is a package for parsing command-line arguments to Julia programs.
111+
- [Parameters.jl](https://github.com/mauro3/Parameters.jl) types with default field values, keyword constructors and (un-)pack macros.
107112
- [BSON.jl](https://github.com/JuliaIO/BSON.jl) is a package for working with the Binary JSON serialisation format.
108113
- [DataFrames.jl](https://github.com/JuliaData/DataFrames.jl) in-memory tabular data in Julia.
109114
- [DrWatson.jl](https://github.com/JuliaDynamics/DrWatson.jl) is a scientific project assistant software.
110115

111116
This tight integration among Julia packages is shown in some of the examples in the [model-zoo](https://github.com/FluxML/model-zoo) repository.
117+
118+
---
119+
120+
## Alternatives to Flux
121+
122+
Julia has several other libraries for making neural networks.
123+
124+
* [SimpleChains.jl](https://github.com/PumasAI/SimpleChains.jl) is focused on making small, simple, CPU-based, neural networks fast. Uses [LoopVectorization.jl](https://github.com/JuliaSIMD/LoopVectorization.jl). (Was `FastChain` in DiffEqFlux.jl)
125+
126+
* [Knet.jl](https://github.com/denizyuret/Knet.jl) is a neural network library built around [AutoGrad.jl](https://github.com/denizyuret/AutoGrad.jl).
127+
128+
* [Lux.jl](https://github.com/avik-pal/Lux.jl) (earlier ExplicitFluxLayers.jl) shares much of the design, use-case, and NNlib.jl / Optimisers.jl back-end of Flux. But instead of encapsulating all parameters within the model structure, it separates this into 3 components: a model, a tree of parameters, and a tree of model states.
129+
130+
!!! compat "Explicit or explicit?"
131+
Flux's [training docs](@ref man-training) talk about changes from Zygote's implicit to
132+
explicit gradients, dictionary-like to tree-like structures.
133+
(See also [Zygote's description](https://fluxml.ai/Zygote.jl/dev/#Explicit-and-Implicit-Parameters-1) of these.)
134+
Lux also uses Zygote, but uses the word "explicit" to mean something unrelated,
135+
namely storing the tree of parameters (and of state) separately from the model.
136+

Diff for: docs/src/gpu.md

+1
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,4 @@ $ export CUDA_VISIBLE_DEVICES='0,1'
182182

183183

184184
More information for conditional use of GPUs in CUDA.jl can be found in its [documentation](https://cuda.juliagpu.org/stable/installation/conditional/#Conditional-use), and information about the specific use of the variable is described in the [Nvidia CUDA blog post](https://developer.nvidia.com/blog/cuda-pro-tip-control-gpu-visibility-cuda_visible_devices/).
185+

Diff for: docs/src/index.md

+11-15
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,25 @@
22

33
Flux is a library for machine learning. It comes "batteries-included" with many useful tools built in, but also lets you use the full power of the Julia language where you need it. We follow a few key principles:
44

5-
* **Doing the obvious thing**. Flux has relatively few explicit APIs for features like regularisation or embeddings. Instead, writing down the mathematical form will work – and be fast.
6-
* **Extensible by default**. Flux is written to be highly extensible and flexible while being performant. Extending Flux is as simple as using your own code as part of the model you want - it is all [high-level Julia code](https://github.com/FluxML/Flux.jl/blob/ec16a2c77dbf6ab8b92b0eecd11661be7a62feef/src/layers/recurrent.jl#L131). When in doubt, it’s well worth looking at [the source](https://github.com/FluxML/Flux.jl/tree/master/src). If you need something different, you can easily roll your own.
7-
* **Play nicely with others**. Flux works well with Julia libraries from [images](https://github.com/JuliaImages/Images.jl) to [differential equation solvers](https://github.com/SciML/DifferentialEquations.jl), so you can easily build complex data processing pipelines that integrate Flux models.
5+
* **Doing the obvious thing**. Flux has relatively few explicit APIs. Instead, writing down the mathematical form will work – and be fast.
6+
* **Extensible by default**. Flux is written to be highly flexible while being performant. Extending Flux is as simple as using your own code as part of the model you want - it is all [high-level Julia code](https://github.com/FluxML/Flux.jl/tree/master/src).
7+
* **Play nicely with others**. Flux works well with unrelated Julia libraries from [images](https://github.com/JuliaImages/Images.jl) to [differential equation solvers](https://github.com/SciML/DifferentialEquations.jl), rather than duplicating them.
88

9-
## Installation
9+
### Installation
1010

11-
Download [Julia 1.6](https://julialang.org/downloads/) or later, preferably the current stable release. You can add Flux using Julia's package manager, by typing `] add Flux` in the Julia prompt.
11+
Download [Julia 1.6](https://julialang.org/downloads/) or later, preferably the current stable release. You can add Flux using Julia's package manager, by typing `] add Flux` in the Julia prompt. This will automatically install several other packages, including [CUDA.jl](https://github.com/JuliaGPU/CUDA.jl) for Nvidia GPU support.
1212

13-
This will automatically install several other packages, including [CUDA.jl](https://github.com/JuliaGPU/CUDA.jl) which supports Nvidia GPUs. To directly access some of its functionality, you may want to add `] add CUDA` too. The page on [GPU support](gpu.md) has more details.
13+
### Learning Flux
1414

15-
Other closely associated packages, also installed automatically, include [Zygote](https://github.com/FluxML/Zygote.jl), [Optimisers](https://github.com/FluxML/Optimisers.jl), [NNlib](https://github.com/FluxML/NNlib.jl), [Functors](https://github.com/FluxML/Functors.jl) and [MLUtils](https://github.com/JuliaML/MLUtils.jl).
15+
The **[quick start](@ref man-quickstart)** page trains a simple neural network.
1616

17-
## Learning Flux
17+
This rest of the **guide** provides a from-scratch introduction to Flux's take on models and how they work, starting with [fitting a line](@ref man-overview). Once you understand these docs, congratulations, you also understand [Flux's source code](https://github.com/FluxML/Flux.jl), which is intended to be concise, legible and a good reference for more advanced concepts.
1818

19-
The [quick start](@ref man-quickstart) page trains a simple neural network.
19+
There are some **tutorials** about building particular models. The **[model zoo](https://github.com/FluxML/model-zoo/)** has starting points for many other common ones. And finally, the **[ecosystem page](ecosystem.md)** lists packages which define Flux models.
2020

21-
This rest of this documentation provides a from-scratch introduction to Flux's take on models and how they work, starting with [fitting a line](@ref man-overview). Once you understand these docs, congratulations, you also understand [Flux's source code](https://github.com/FluxML/Flux.jl), which is intended to be concise, legible and a good reference for more advanced concepts.
21+
The **reference** section includes, beside Flux's own functions, those of some companion packages: [Zygote.jl](https://github.com/FluxML/Zygote.jl) (automatic differentiation), [Optimisers.jl](https://github.com/FluxML/Optimisers.jl) (training) and others.
2222

23-
Sections with 📚 contain API listings. The same text is avalable at the Julia prompt, by typing for example `?gpu`.
24-
25-
If you just want to get started writing models, the [model zoo](https://github.com/FluxML/model-zoo/) gives good starting points for many common ones.
26-
27-
## Community
23+
### Community
2824

2925
Everyone is welcome to join our community on the [Julia discourse forum](https://discourse.julialang.org/), or the [slack chat](https://discourse.julialang.org/t/announcing-a-julia-slack/4866) (channel #machine-learning). If you have questions or issues we'll try to help you out.
3026

Diff for: docs/src/models/basics.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,13 @@ m(5) # => 26
213213

214214
## Layer Helpers
215215

216-
There is still one problem with this `Affine` layer, that Flux does not know to look inside it. This means that [`Flux.train!`](@ref) won't see its parameters, nor will [`gpu`](@ref) be able to move them to your GPU. These features are enabled by the `@functor` macro:
216+
There is still one problem with this `Affine` layer, that Flux does not know to look inside it. This means that [`Flux.train!`](@ref) won't see its parameters, nor will [`gpu`](@ref) be able to move them to your GPU. These features are enabled by the [`@functor`](@ref Functors.@functor) macro:
217217

218218
```
219219
Flux.@functor Affine
220220
```
221221

222-
Finally, most Flux layers make bias optional, and allow you to supply the function used for generating random weights. We can easily add these refinements to the `Affine` layer as follows:
222+
Finally, most Flux layers make bias optional, and allow you to supply the function used for generating random weights. We can easily add these refinements to the `Affine` layer as follows, using the helper function [`create_bias`](@ref Flux.create_bias):
223223

224224
```
225225
function Affine((in, out)::Pair; bias=true, init=Flux.randn32)
@@ -230,7 +230,3 @@ end
230230
231231
Affine(3 => 1, bias=false, init=ones) |> gpu
232232
```
233-
234-
```@docs
235-
Functors.@functor
236-
```

Diff for: docs/src/models/nnlib.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Neural Network primitives from NNlib.jl
22

3-
Flux re-exports all of the functions exported by the [NNlib](https://github.com/FluxML/NNlib.jl) package. This includes activation functions, described on the next page. Many of the functions on this page exist primarily as the internal implementation of Flux layer, but can also be used independently.
3+
Flux re-exports all of the functions exported by the [NNlib](https://github.com/FluxML/NNlib.jl) package. This includes activation functions, described on [their own page](@ref man-activations). Many of the functions on this page exist primarily as the internal implementation of Flux layer, but can also be used independently.
44

55
## Softmax
66

Diff for: docs/src/tutorials/2021-10-14-vanilla-gan.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type `add MLDatasets` or perform this operation with the Pkg module like this
3232
> Pkg.add(MLDatasets)
3333
```
3434

35-
While [UnicodePlots]() is not necessary, it can be used to plot generated samples
35+
While [UnicodePlots](https://github.com/JuliaPlots/UnicodePlots.jl) is not necessary, it can be used to plot generated samples
3636
into the terminal during training. Having direct feedback, instead of looking
3737
at plots in a separate window, use fantastic for debugging.
3838

0 commit comments

Comments
 (0)