Skip to content

Pollen docs update part 2 #213

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

Merged
merged 5 commits into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pollenexport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
version: '1.7'
- name: "Install package and docs dependencies"
run: |
julia --color=yes --project=docs/ -e 'using Pkg; Pkg.add([Pkg.PackageSpec(path="."), Pkg.PackageSpec(url="https://github.com/lorenzoh/ModuleInfo.jl"), Pkg.PackageSpec(url="https://github.com/lorenzoh/Pollen.jl", rev="frontend")]); Pkg.instantiate();'
julia --color=yes --project=docs/ -e 'using Pkg; Pkg.add([Pkg.PackageSpec(path="."), Pkg.PackageSpec(url="https://github.com/c42f/JuliaSyntax.jl"), Pkg.PackageSpec(url="https://github.com/lorenzoh/ModuleInfo.jl"), Pkg.PackageSpec(url="https://github.com/lorenzoh/Pollen.jl", rev="main")]); Pkg.instantiate();'
- name: Build
run: |
julia --color=yes --project=docs/ ./docs/make.jl ./pollen/dev/
Expand Down
8 changes: 5 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ julia = "1.6"
[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[publish]
theme = "theme"
title = "FastAI.jl"

[targets]
test = ["Test"]


[pollen]
title = "FastAI.jl"
url = "https://github.com/FluxML/FastAI.jl"
1 change: 0 additions & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ BSON = "fbb218c0-5317-5bc6-957e-2ee96dd4b1f0"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Crayons = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f"
DLPipelines = "e6530d7c-7faa-4ede-a0d6-9eff9baad396"
DataAugmentation = "88a5189c-e7ff-4f85-ac6b-e6158070f02e"
FilePathsBase = "48062228-2e41-5def-b9a4-89aafe57970f"
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
Expand Down
4 changes: 2 additions & 2 deletions docs/howto/logtensorboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ callbacks = [
Metrics(accuracy)
]

data = ...
task = ...
data = _
task = _
learner = tasklearner(task, data; callbacks=callbacks)
fitonecycle!(learner, 5)
```
Expand Down
28 changes: 19 additions & 9 deletions docs/toc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@
"Overview": "documents/README.md",
"Setup": "documents/docs/setup.md",
"Quickstart": "documents/notebooks/quickstart.ipynb",
"Tutorials": {
"Beginner": {
"Core": {
"Tutorials": {
"Introduction": "documents/docs/introduction.md",
"Discovering functionality": "documents/docs/discovery.md"
"Discovering functionality": "documents/docs/discovery.md",
"Intermediate": {
"Data containers": "documents/docs/data_containers.md"
},
"Advanced": {
"Unsupervised learning with VAEs": "documents/notebooks/vae.ipynb"
}
},
"Intermediate": {
"Data containers": "documents/docs/data_containers.md"
"How-to": {
"Train a model": "documents/notebooks/training.ipynb",
"Load and save models": "documents/notebooks/serialization.ipynb",
"Log to TensorBoard": "documents/notebooks/training.ipynb"
},
"Advanced": {
"Unsupervised learning tasks": "documents/notebooks/vae.ipynb"
"Background": {
"Comparison to fast.ai": "documents/docs/fastai_api_comparison.md",
"Performant data pipelines": "documents/docs/background/datapipelines.md",
"Blocks and Encodings": "documents/docs/background/blocksencodings.md"
}
},
"Computer vision": {
Expand All @@ -20,8 +30,8 @@
"Keypoint regression": "documents/notebooks/keypointregression.ipynb"
},
"How-To": {
"Use augmentations": "documents/docs/augmentvision.md",
"Presize vision datasets": "notebooks/presizing.ipynb"
"Use augmentations": "documents/docs/howto/augmentvision.md",
"Presize vision datasets": "documents/notebooks/presizing.ipynb"
}
},
"Tabular data": {
Expand Down
28 changes: 0 additions & 28 deletions notebooks/quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,39 +29,11 @@
"In this quick start, we'll show these steps for a wide range of difference applications and datasets. As you'll see, the code in each case is extremely similar, despite the very different models and data being used."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001b[32m\u001b[1m Activating\u001b[22m\u001b[39m environment at `~/.julia/dev/FastAI/notebooks/Project.toml`\n"
]
}
],
"source": [
"]activate ."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"┌ Info: Precompiling CairoMakie [13f3f980-e62b-5c42-98c6-ff1f3baf88f0]\n",
"└ @ Base loading.jl:1342\n",
"┌ Info: Precompiling FastAI [5d0beca9-ade8-49ae-ad0b-a3cf890e669f]\n",
"└ @ Base loading.jl:1342\n",
"WARNING: using Makie.Label in module FastAI conflicts with an existing identifier.\n"
]
}
],
"source": [
"import CairoMakie\n",
Expand Down
2 changes: 1 addition & 1 deletion src/FastAI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export
include("interpretation/makie/stub.jl")
function __init__()
@require Makie="ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" begin
using .Makie
import .Makie as M
include("interpretation/makie/showmakie.jl")
include("interpretation/makie/lrfind.jl")
end
Expand Down
2 changes: 1 addition & 1 deletion src/datasets/recipe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ For example implementations, see [`Vision.ImageFolders`](#).
Given

```julia
data, blocks = loadrecipe(recipe, args....; kwargs...)
data, blocks = loadrecipe(recipe, args...; kwargs...)
```

the following must hold:
Expand Down
2 changes: 1 addition & 1 deletion src/fasterai/taskregistry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Find learning tasks compatible with block types `TBlocks` in

#### Examples

```julia
```julia-repl
julia> findlearningtasks((Image, Label))
[ImageClassificationSingle,]

Expand Down
38 changes: 19 additions & 19 deletions src/interpretation/makie/showmakie.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import FastAI: createhandle, showblock!


function createhandle(backend::ShowMakie; kwargs...)
fig = Figure(; kwargs..., backend.kwargs...)
grid = fig[1, 1] = GridLayout()
fig = M.Figure(; kwargs..., backend.kwargs...)
grid = fig[1, 1] = M.GridLayout()
return grid
end

Expand Down Expand Up @@ -36,25 +36,25 @@ function showblock!(grid, backend::ShowMakie, blocks::Tuple, obss::Tuple)
header = [block isa Pair ? first(block) : "" for block in blocks]
blocks = Tuple(block isa Pair ? last(block) : block for block in blocks)

rowsize!(grid, 1, Makie.Fixed(backend.size[2]))
M.rowsize!(grid, 1, M.Fixed(backend.size[2]))


# Show blocks in a row
col = 1
for (i, (block, obs)) in enumerate(zip(blocks, obss))
w = _nblocks(block)
subgrid = grid[1, col:col+w-1] = GridLayout(tellheight = false)
subgrid = grid[1, col:col+w-1] = M.GridLayout(tellheight = false)
showblock!(subgrid, backend, block, obs)
for j = col:col+w-1
colsize!(grid, j, Makie.Fixed(backend.size[1]))
M.colsize!(grid, j, M.Fixed(backend.size[1]))
end
col += w
end

# Add titles to named blocks
Makie.Label(grid[0, 1], "", tellwidth = false, textsize = 25)
M.Label(grid[0, 1], "", tellwidth = false, textsize = 25)
for (i, title) in enumerate(header)
Makie.Label(grid[1, i], title, tellwidth = false, textsize = 25)
M.Label(grid[1, i], title, tellwidth = false, textsize = 25)
end

end
Expand All @@ -81,21 +81,21 @@ function showblocks!(grid, backend::ShowMakie, blocks::Tuple, obss::AbstractVect

# Show each sample in one row
for (i, obs) in enumerate(obss)
subgrid = grid[i, 1:n] = GridLayout(tellheight = false)
rowsize!(grid, i, Makie.Fixed(backend.size[2]))
subgrid = grid[i, 1:n] = M.GridLayout(tellheight = false)
M.rowsize!(grid, i, M.Fixed(backend.size[2]))
showblock!(subgrid, backend, blocks, obs)
end

for i = 1:n
colsize!(grid, i, Makie.Fixed(backend.size[1]))
M.colsize!(grid, i, M.Fixed(backend.size[1]))
end

# Add titles to named blocks
Makie.Label(grid[0, 1], "", textsize = 25)
M.Label(grid[0, 1], "", textsize = 25)
col = 1
for (i, (title, block)) in enumerate(zip(header, blocks))
w = _nblocks(block)
Makie.Label(grid[1, col:col+w-1], title, tellwidth = false, textsize = 25)
M.Label(grid[1, col:col+w-1], title, tellwidth = false, textsize = 25)
col += w
end
end
Expand Down Expand Up @@ -125,14 +125,14 @@ function showblock!(
if !(sum(obs) ≈ 1)
obs = softmax(obs)
end
ax = Axis(grid[1, 1], yticks = (1:length(block.classes), string.(block.classes)))
barplot!(ax, obs, direction = :x)
hidespines!(ax)
ax = M.Axis(grid[1, 1], yticks = (1:length(block.classes), string.(block.classes)))
M.barplot!(ax, obs, direction = :x)
M.hidespines!(ax)
end


function default_showbackend()
if ismissing(Makie.current_backend[])
if ismissing(M.current_backend[])
return ShowText()
else
return ShowMakie()
Expand All @@ -148,8 +148,8 @@ end
Create a `Makie.Axis` with no interactivity, decorations and aspect distortion.
"""
function cleanaxis(f; kwargs...)
ax = Makie.Axis(f; kwargs...)
ax.aspect = Makie.DataAspect()
ax = M.Axis(f; kwargs...)
ax.aspect = M.DataAspect()
ax.xzoomlock = true
ax.yzoomlock = true
ax.xrectzoom = false
Expand All @@ -161,7 +161,7 @@ function cleanaxis(f; kwargs...)
ax.leftspinevisible = false
ax.rightspinevisible = false
ax.topspinevisible = false
Makie.hidedecorations!(ax)
M.hidedecorations!(ax)

return ax
end
14 changes: 7 additions & 7 deletions src/tasks/check.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ function checktask_core(
sample = mocksample(task),
devicefn = identity,
)
@testset "Core interface" begin
@testset "`encode`" begin
Test.@testset "Core interface" begin
Test.@testset "`encode`" begin
for context in CONTEXTS
@test_nowarn encodesample(task, context, sample)
Test.@test_nowarn encodesample(task, context, sample)
end
end
@testset "Model compatibility" begin
Test.@testset "Model compatibility" begin
for context in CONTEXTS
x, _ = encodesample(task, context, sample)
@test_nowarn ŷ = _predictx(task, model, x, devicefn)
Test.@test_nowarn ŷ = _predictx(task, model, x, devicefn)
end
end
@testset "`decodeypred" begin
Test.@testset "`decodeypred" begin
for context in CONTEXTS
x, _ = encodesample(task, context, sample)
ŷ = _predictx(task, model, x, devicefn)
@test_nowarn decodeypred(task, context, ŷ)
Test.@test_nowarn decodeypred(task, context, ŷ)
end
end
end
Expand Down
1 change: 0 additions & 1 deletion src/training/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ from there.
If `learner` does not have a `Scheduler` callback yet, adds it.

```julia
learner = ...
fit!(learner, 1)
setschedules!(learner, onecycle(1, 0.01))
fit!(learner, 1)
Expand Down
29 changes: 0 additions & 29 deletions toc.md

This file was deleted.