Skip to content

Commit

Permalink
Switch to DemoCards.jl (#206)
Browse files Browse the repository at this point in the history
* Use DemoCards.jl

* Add cache files to reduce load on CI

* Fix notebooks

* Add compat

* Discussed changes

* Remove the pre-rendered files
  • Loading branch information
Dsantra92 authored Oct 16, 2022
1 parent 3c9bbd5 commit e1aedc1
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 58 deletions.
7 changes: 5 additions & 2 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
[deps]
DemoCards = "311a05b2-6137-4a5a-b473-18580a3d38b5"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
GraphNeuralNetworks = "cffab07f-9bc2-4db1-8861-388f63bf7694"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MarkdownLiteral = "736d6165-7244-6769-4267-6b50796e6954"
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
Pluto = "c3e4b0f8-55cb-11ea-2926-15256bba5781"
PlutoStaticHTML = "359b1769-a58e-495b-9770-312e911026ad"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"


[compat]
DemoCards = "^0.4.10"
40 changes: 8 additions & 32 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,31 +1,10 @@
using Flux, NNlib, GraphNeuralNetworks, Graphs, SparseArrays
using Documenter
using Documenter, DemoCards

# See this for a template of Pluto+Documenter
# https://github.com/rikhuijzer/PlutoStaticHTML.jl/blob/main/docs/make.jl
using Pluto, PlutoStaticHTML
using Documenter: MathJax3
tutorials, tutorials_cb, tutorial_assets = makedemos("tutorials")

pluto_src_folder = joinpath(@__DIR__, "src", "tutorials")

"""
build()
Run all Pluto notebooks (".jl" files) in `NOTEBOOK_DIR`.
"""
function build()
println("Building notebooks")
hopts = HTMLOptions(; append_build_context=false)
output_format = documenter_output
bopts = BuildOptions(pluto_src_folder; output_format)
build_notebooks(bopts, hopts)
return nothing
end

# Build the notebooks; defaults to true.
if get(ENV, "BUILD_DOCS_NOTEBOOKS", "true") == "true"
build()
end
assets = []
isnothing(tutorial_assets) || push!(assets, tutorial_assets)

DocMeta.setdocmeta!(GraphNeuralNetworks, :DocTestSetup,
:(using GraphNeuralNetworks, Graphs, SparseArrays, NNlib, Flux);
Expand All @@ -38,19 +17,14 @@ makedocs(;
modules = [GraphNeuralNetworks, NNlib, Flux, Graphs, SparseArrays],
doctest = false,
clean = true,
format= Documenter.HTML(; mathengine, prettyurls),
format= Documenter.HTML(; mathengine, prettyurls, assets=assets),
sitename = "GraphNeuralNetworks.jl",
pages = ["Home" => "index.md",
"Graphs" => "gnngraph.md",
"Message Passing" => "messagepassing.md",
"Model Building" => "models.md",
"Datasets" => "datasets.md",
"Tutorials" =>
[
"Intro to Graph Neural Networks" => "tutorials/gnn_intro_pluto.md",
"Graph Classification" => "tutorials/graph_classification_pluto.md",
"Node Classification" => "tutorials/node_classification_pluto.md",
],
"Tutorials" => tutorials,
"API Reference" =>
[
"GNNGraph" => "api/gnngraph.md",
Expand All @@ -65,4 +39,6 @@ makedocs(;
],
)

tutorials_cb()

deploydocs(repo="github.com/CarloLucibello/GraphNeuralNetworks.jl.git")
1 change: 0 additions & 1 deletion docs/src/tutorials/.gitignore

This file was deleted.

3 changes: 3 additions & 0 deletions docs/tutorials/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"theme": "grid"
}
19 changes: 19 additions & 0 deletions docs/tutorials/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# [Tutorials](@id tutorials)

---

{{{democards}}}

---

## Contributions

If you have a suggestion on adding new tutorials, feel free to create a new issue
[here](https://github.com/CarloLucibello/GraphNeuralNetworks.jl/issues/new).
Users are invited to contribute demonstrations of their own.
If you want to contribute new tutorials and looking for inspiration,
checkout these tutorials from
[PyTorch Geometric](https://pytorch-geometric.readthedocs.io/en/latest/notes/colabs.html).
You are expected to use [Pluto.jl](https://github.com/fonsp/Pluto.jl) notebooks
with [DemoCards.jl](https://github.com/JuliaDocs/DemoCards.jl).
Please check out exsisting tutorials for more details.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### A Pluto.jl notebook ###
# v0.19.5
# v0.19.11

using Markdown
using InteractiveUtils
Expand All @@ -10,13 +10,13 @@ begin
using Pkg
Pkg.activate(; temp=true)
packages = [
PackageSpec(; path=joinpath(@__DIR__,"..","..","..")),
PackageSpec(; name="GraphNeuralNetworks", version="0.4"),
PackageSpec(; name="Flux", version="0.13"),
PackageSpec(; name="MLDatasets", version="0.7"),
PackageSpec(; name="GraphMakie"),
PackageSpec(; name="Graphs"),
PackageSpec(; name="CairoMakie"),
PackageSpec(; name="PlutoUI"),
PackageSpec(; name="MLDatasets", version="0.7"),
PackageSpec(; name="GraphMakie"),
PackageSpec(; name="Graphs"),
PackageSpec(; name="CairoMakie"),
PackageSpec(; name="PlutoUI"),
]
Pkg.add(packages)
end
Expand All @@ -36,10 +36,19 @@ begin
Random.seed!(17) # for reproducibility
end;

# ╔═╡ 03a9e023-e682-4ea3-a10b-14c4d101b291
# ╔═╡ cc051aa1-b929-4bca-b261-7f797a644a2b
md"""
# Introduction: Hands-on Graph Neural Networks
---
title: Hands-on introduction to Graph Neural Networks
cover: assets/intro_1.png
author: "[Carlo Lucibello](https://github.com/CarloLucibello)"
date: 2022-05-24
description: A beginner level introduction to graph machine learning using GraphNeuralNetworks.jl.
---
"""

# ╔═╡ 03a9e023-e682-4ea3-a10b-14c4d101b291
md"""
*This Pluto notebook is a julia adaptation of the Pytorch Geometric tutorials that can be found [here](https://pytorch-geometric.readthedocs.io/en/latest/notes/colabs.html).*
Recently, deep learning on graphs has emerged to one of the hottest research fields in the deep learning community.
Expand Down Expand Up @@ -330,6 +339,7 @@ Furthermore, we did this all with a few lines of code, thanks to the GraphNeural
"""

# ╔═╡ Cell order:
# ╟─cc051aa1-b929-4bca-b261-7f797a644a2b
# ╟─03a9e023-e682-4ea3-a10b-14c4d101b291
# ╟─6f20e59c-b002-4d22-9ee0-b62596574776
# ╠═361e0948-d91a-11ec-2d95-2db77435a0c1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
### A Pluto.jl notebook ###
# v0.19.6

#> [frontmatter]
#> title = "Graph Classification with Graph Neural Networks"
#> date = "2022-05-23"
# v0.19.11

using Markdown
using InteractiveUtils
Expand All @@ -14,10 +10,10 @@ begin
using Pkg
Pkg.activate(; temp=true)
Pkg.add([
PackageSpec(; path=joinpath(@__DIR__,"..","..","..")),
PackageSpec(; name="GraphNeuralNetworks", version="0.4"),
PackageSpec(; name="Flux", version="0.13"),
PackageSpec(; name="MLDatasets", version="0.7"),
PackageSpec(; name="MLUtils"),
PackageSpec(; name="MLDatasets", version="0.7"),
PackageSpec(; name="MLUtils"),
])
Pkg.develop("GraphNeuralNetworks")
end
Expand All @@ -36,10 +32,19 @@ begin
Random.seed!(17) # for reproducibility
end;

# ╔═╡ 15136fd8-f9b2-4841-9a95-9de7b8969687
# ╔═╡ c07e1be9-adb6-4454-8128-bc8917406c58
md"""
# Graph Classification with Graph Neural Networks
---
title: Graph Classification with Graph Neural Networks
cover: assets/graph_classification.gif
author: "[Carlo Lucibello](https://github.com/CarloLucibello)"
date: 2022-05-23
description: Tutorial for Graph Classification using GraphNeuralNetworks.jl
---
"""

# ╔═╡ 15136fd8-f9b2-4841-9a95-9de7b8969687
md"""
*This Pluto notebook is a julia adaptation of the Pytorch Geometric tutorials that can be found [here](https://pytorch-geometric.readthedocs.io/en/latest/notes/colabs.html).*
In this tutorial session we will have a closer look at how to apply **Graph Neural Networks (GNNs) to the task of graph classification**.
Expand Down Expand Up @@ -271,9 +276,10 @@ You have learned how graphs can be batched together for better GPU utilization,
"""

# ╔═╡ Cell order:
# ╠═c97a0002-2253-45b6-9266-017189dbb6fe
# ╟─c07e1be9-adb6-4454-8128-bc8917406c58
# ╟─cc97a0002-2253-45b6-9266-017189dbb6fe
# ╠═361e0948-d91a-11ec-2d95-2db77435a0c1
# ╟─15136fd8-f9b2-4841-9a95-9de7b8969687
# ╠═15136fd8-f9b2-4841-9a95-9de7b8969687
# ╠═f6e86958-e96f-4c77-91fc-c72d8967575c
# ╠═24f76360-8599-46c8-a49f-4c31f02eb7d8
# ╠═5d5e5152-c860-4158-8bc7-67ee1022f9f8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ begin
using Pkg
Pkg.activate(; temp=true)
packages = [
PackageSpec(; path=joinpath(@__DIR__,"..","..","..")),
PackageSpec(; name="GraphNeuralNetworks", version="0.4"),
PackageSpec(; name="Flux", version="0.13"),
PackageSpec(; name="MLDatasets", version="0.7"),
PackageSpec(; name="Plots"),
Expand Down Expand Up @@ -38,7 +38,13 @@ end

# ╔═╡ 8db76e69-01ee-42d6-8721-19a3848693ae
md"""
# Node Classification
---
title: Node Classification with Graph Neural Networks
cover: assets/node_classsification.gif
author: "[Deeptendu Santra](https://github.com/Dsantra92)"
date: 2022-09-25
description: Tutorial for Node classification using GraphNeuralNetworks.jl
---
"""

# ╔═╡ ca2f0293-7eac-4d9a-9a2f-fda47fd95a99
Expand Down

0 comments on commit e1aedc1

Please sign in to comment.