Skip to content

Commit 838d8ef

Browse files
lorenzohdarsnack
andauthored
Improve onboarding experience (#227)
* Update README * Add a contributor guide and dev instructions Co-authored-by: Kyle Daruwalla <[email protected]>
1 parent 3db530d commit 838d8ef

File tree

5 files changed

+152
-76
lines changed

5 files changed

+152
-76
lines changed

CONTRIBUTING.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Contributor guide for FastAI.jl
2+
3+
First off, thank you for considering contributing to FastAI.jl. We welcome contributions and are happy to work with you!
4+
5+
FastAI.jl is part of the FluxML GitHub organization and follows the same guidelines laid out in [Flux.jl's CONTRIBUTING.md](https://github.com/FluxML/Flux.jl/blob/master/CONTRIBUTING.md). That guide also includes a lot of tips for first-time contributors to open source.
6+
7+
## Example contributions
8+
9+
The list below just gives a few examples of welcome contributions, but of course, you can always open an issue to discuss other kinds of contributions.
10+
11+
- Bug reports: If you encounter an error and think it is due to a bug in FastAI.jl, open an issue with a bug report as explained here: [How to file a bug report](https://github.com/FluxML/Flux.jl/blob/master/CONTRIBUTING.md#how-to-file-a-bug-report)
12+
- Features: There are many kinds of features that you can contribute to FastAI.jl, like datasets, models, recipes and tasks. In most cases, it makes sense to open an issue first to discuss the scope and implementation of the feature.
13+
- Examples: We're always happy about more usage examples for the documentation. A good starting point for this can be an existing tutorial in another language like Python that you're recreating using FastAI.jl and the Julia ecosystem.
14+
15+
To get started with code or documentation contributions, please see [DEVELOPING.md](DEVELOPING.md) for instructions on setting up a local dev environment and runnning the tests as well as the documentation.

DEVELOPING.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Developing
2+
3+
This guide contains information important when developing FastAI.jl. Concretely:
4+
5+
- how to set up a local development environment
6+
- how to run the tests
7+
- how to preview the documentation locally
8+
9+
## Setting up FastAI.jl locally for development
10+
11+
**Fork FastAI.jl and add it as a `dev` dependency.** You can fork it from [the GitHub repository](https://github.com/FluxML/FastAI.jl). Then use `Pkg` to add the fork to your Julia environment:
12+
13+
```julia
14+
using Pkg
15+
Pkg.develop(url="https://github.com/<myusername>/FastAI.jl.git")
16+
```
17+
18+
You should now be able to import FastAI (`using FastAI`) in Julia. If you are using [Revise.jl](https://github.com/timholy/Revise.jl), any changes you make to its source code will also be reflected in your interactive sessions.
19+
20+
21+
## Running the tests
22+
23+
Like any Julia package, you can run the entire test suite in an isolated environment using `Pkg.test`:
24+
25+
```julia
26+
using Pkg
27+
Pkg.test("FastAI")
28+
```
29+
30+
When developing, however, it can be helpful to repeatedly rerun parts of the tests. FastAI.jl uses [ReTest.jl](https://github.com/JuliaTesting/ReTest.jl) to set up tests which makes it possible to run subsets of tests or only tests that have not previously succeeded.
31+
32+
First, activate the test environment and install its dependencies:
33+
34+
```julia
35+
using Pkg
36+
Pkg.activate(joinpath(Pkg.devdir(), "FastAI", "test"))
37+
Pkg.instantiate()
38+
```
39+
40+
Then, you can run the test suite or subsets of it:
41+
42+
```julia
43+
using FastAI, ReTest
44+
45+
FastAI.runtests() # full test suite
46+
FastAI.runtests("block") # all tests containing `"block"`
47+
FastAI.runtests([ReTest.fail, ReTest.not(ReTest.pass)]) # run only tests that have not been run or have failed previously
48+
49+
```
50+
51+
52+
## Local documentation preview
53+
54+
FastAI.jl uses [Pollen.jl](https://github.com/lorenzoh/Pollen.jl) as its documentation system, which allows you to preview documentation locally.
55+
56+
First, activate the documentation environment and install its dependencies:
57+
58+
```julia
59+
using Pkg
60+
Pkg.activate(joinpath(Pkg.devdir(), "FastAI", "docs"))
61+
Pkg.add([
62+
Pkg.PackageSpec(url="https://github.com/c42f/JuliaSyntax.jl"),
63+
Pkg.PackageSpec(url="https://github.com/lorenzoh/ModuleInfo.jl"),
64+
Pkg.PackageSpec(url="https://github.com/lorenzoh/Pollen.jl", rev="main"),
65+
])
66+
```
67+
68+
Now you can build the documentation locally, giving you a preview at [http://localhost:3000](http://localhost:3000). Using the `lazy = true` will build pages lazily only once you request them on the website, which reduces the build time when you only care about specific pages.
69+
70+
71+
```julia
72+
using FastAI, Pollen
73+
Pollen.servedocs(@__MODULE__, FastAI, lazy = true)
74+
```
75+
76+
### Adding documentation pages files
77+
78+
Documentation pages correspond to a Markdown `.md` or Jupyter Notebook `.ipynb` file that should be stored in the `docs/` folder. If a document should show up in the left sidebar of the docs page, add an entry to `FastAI/docs/toc.json`.
79+
80+
- Jupyter Notebooks should be used when they use resources that are not available on the GitHub CI, like a GPU needed for training. You should run them locally and the outputs will be captured and inserted into the HTML page.
81+
- Markdown documents should be preferred for everything else, as they allow the code examples to be run on the GitHub CI, meaning they'll stay up-to-date unlike a notebook that has to be manually rerun.
82+
83+
Both formats support the [Markdown syntax of Publish.jl](https://michaelhatherly.github.io/Publish.jl/dev/docs/syntax.html) and in markdown files the [cell syntax of Publish.jl](https://michaelhatherly.github.io/Publish.jl/dev/docs/cells.html) can be used to mark code cells. These will be run and the output is inserted into the HTML page.
84+
85+
### Linking to documentation
86+
87+
For a new documentation file to be discoverable, you have to add an entry to the nested Markdown list in `toc.md`, which corresponds to the sidebar in the documentation _(updating the sidebar currently requires interrupting and reincluding the file that starts the development server)_.
88+
89+
Documentation pages can also link to each other using standard Markdown link syntax.
90+
91+
### Referencing code symbols
92+
93+
Symbols like `fitonecycle!` can be referenced by using the cross-referencing syntax ```[`fitonecycle!`](#) ``` which will link to and create a reference page from the symbol's docstrings. It will also be added as an entry on the references page.

README.md

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,59 @@
1-
# FastAI
1+
# FastAI.jl
22

3-
[Documentation](https://fluxml.ai/FastAI.jl)
3+
![](fastai-julia-logo.png)
4+
FastAI.jl is a Julia library for training state-of-the art deep learning models.
45

5-
FastAI.jl is inspired by [fastai](https://github.com/fastai/fastai), and is a repository of best practices for deep learning in Julia. Its goal is to easily enable creating state-of-the-art models. FastAI enables the design, training, and delivery of deep learning models that compete with the best in class, using few lines of code.
6+
From loading datasets and creating data preprocessing pipelines to training, FastAI.jl takes the boilerplate out of deep learning projects. It equips you with reusable components for every part of your project while remaining customizable at every layer. FastAI.jl comes with support for common computer vision and tabular data learning tasks, with more to come.
67

7-
Install with
8+
FastAI.jl's high-level workflows combine functionality from many packages in the ecosystem, most notably [Flux.jl](https://github.com/FluxML/Flux.jl), [FluxTraining.jl](https://github.com/FluxML/FluxTraining.jl), [DataAugmentation.jl](https://github.com/lorenzoh/DataAugmentation.jl) and [MLUtils.jl](https://github.com/JuliaML/MLUtils.jl).
89

9-
```julia
10-
using Pkg
11-
Pkg.add("FastAI")
12-
```
10+
See our [**documentation**](https://fluxml.ai/FastAI.jl) to find out more.
1311

14-
or try it out with this [Google Colab template](https://colab.research.google.com/gist/lorenzoh/2fdc91f9e42a15e633861c640c68e5e8).
12+
## Features
13+
14+
- [download commmon datasets](TODO: `datasets`) or [bring your own](TODO: data_containers.md)
15+
-
16+
17+
## Example
1518

1619
As an example, here is how to train an image classification model:
1720

1821
```julia
1922
using FastAI
20-
data, blocks = load(datarecipes()["imagenette2-160"])
23+
data, blocks = load(datarecipes()["imagenette2-320"])
2124
task = ImageClassificationSingle(blocks)
2225
learner = tasklearner(task, data, callbacks=[ToGPU()])
2326
fitonecycle!(learner, 10)
2427
showoutputs(task, learner)
2528
```
2629

27-
Please read [the documentation](https://fluxml.github.io/FastAI.jl/dev) for more information and see the [setup instructions](docs/setup.md).
30+
## Setup
31+
32+
To get started, install FastAI.jl using the Julia package manager:
33+
34+
```julia
35+
using Pkg
36+
Pkg.add("FastAI")
37+
```
38+
39+
or try it out with this [Google Colab template](https://colab.research.google.com/gist/lorenzoh/2fdc91f9e42a15e633861c640c68e5e8).
40+
41+
## Getting started
42+
43+
To dive in, you may be interested in
44+
45+
- an [overview of the high-level API](https://fluxml.ai/FastAI.jl/dev/i/?id=documents%2Fdocs%2Fintroduction.md),
46+
- seeing some [example learning tasks](https://fluxml.ai/FastAI.jl/dev/i/?id=documents%2Fnotebooks%2Fquickstart.ipynb),
47+
- finding out [how you can search for and find datasets and other functionality](https://fluxml.ai/FastAI.jl/dev/i/?id=documents%2Fdocs%2Fdiscovery.md); or
48+
- [our contributor guide](CONTRIBUTING.md)
49+
50+
## Get in touch
51+
52+
You can get in touch here on GitHub or on the JuliaLang Zulip in the [`#ml-contributors` channel](https://julialang.zulipchat.com/#narrow/stream/237432-ml-contributers).
53+
54+
---
55+
## Acknowledgements
56+
57+
FastAI.jl takes inspiration from the fantastic [fastai](http://docs.fast.ai) library for Python. Jeremy Howard and the fastai team kindly approved this project and its use of the fastai name.
58+
59+
This project also builds on many packages in the Julia ecosystem.

developing.md

Lines changed: 0 additions & 65 deletions
This file was deleted.

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ using FastAI
66
using ReTest
77
FastAI.runtests([ReTest.fail, ReTest.not(ReTest.pass)])
88

9+
910
module FastAITests
1011

1112
using InlineTest

0 commit comments

Comments
 (0)