From 290aed6df146269d7d523b925fb247fe053ee80e Mon Sep 17 00:00:00 2001 From: Saransh Date: Fri, 12 Aug 2022 18:18:48 +0530 Subject: [PATCH 01/10] Migrate to `Documenter.jl` --- .github/workflows/CI.yml | 26 ++++++ .github/workflows/Publish.yml | 33 ------- .github/workflows/PublishStable.yml | 32 ------- .github/workflows/clean_preview.yml | 27 ++++++ .github/workflows/pr_comment.yml | 14 +++ README.md | 52 +++++------ docs/.gitignore | 2 + docs/Project.toml | 6 +- docs/make.jl | 40 ++++++--- docs/serve.jl | 17 ---- docs/src/api/models.md | 30 +++++++ docs/src/assets/flux.css | 113 ++++++++++++++++++++++++ docs/{dev-guide => src}/contributing.md | 0 docs/src/index.md | 44 +++++++++ docs/{ => src}/tutorials/quickstart.md | 9 +- toc.md | 11 --- 16 files changed, 315 insertions(+), 141 deletions(-) delete mode 100644 .github/workflows/Publish.yml delete mode 100644 .github/workflows/PublishStable.yml create mode 100644 .github/workflows/clean_preview.yml create mode 100644 .github/workflows/pr_comment.yml create mode 100644 docs/.gitignore delete mode 100644 docs/serve.jl create mode 100644 docs/src/api/models.md create mode 100644 docs/src/assets/flux.css rename docs/{dev-guide => src}/contributing.md (100%) create mode 100644 docs/src/index.md rename docs/{ => src}/tutorials/quickstart.md (88%) delete mode 100644 toc.md diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f796a66d7..cd490d637 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -93,3 +93,29 @@ jobs: - uses: codecov/codecov-action@v2 with: file: lcov.info + + docs: + name: Documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@v1 + with: + version: '1.6' + - run: | + julia --project=docs -e ' + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate()' + - run: | + julia --color=yes --project=docs/ -e ' + using Metalhead + # using Pkg; Pkg.activate("docs") + using Documenter + using Documenter: doctest + DocMeta.setdocmeta!(Metalhead, :DocTestSetup, :(using Metalhead); recursive=true) + doctest(Metalhead)' + - run: julia --project=docs docs/make.jl + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} diff --git a/.github/workflows/Publish.yml b/.github/workflows/Publish.yml deleted file mode 100644 index 5d59ed275..000000000 --- a/.github/workflows/Publish.yml +++ /dev/null @@ -1,33 +0,0 @@ -# Adapted from https://github.com/MichaelHatherly/Publish.jl -name: Publish - -on: - push: - branches: 'master' - -jobs: - publish: - name: "Publish Documentation (dev)" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/checkout@v2 - with: - ref: gh-pages - path: gh-pages - - uses: julia-actions/setup-julia@latest - with: - version: '1' - - name: Install dependencies - run: | - julia --color=yes --project=. -e 'using Pkg; Pkg.instantiate()' - - name: Build and deploy - run: | - cd gh-pages - julia --color=yes --project=../docs -e "using Pkg; Pkg.instantiate()" - julia --color=yes --project=../docs -e 'include("../docs/make.jl"); build_and_deploy("dev")' - git config user.name github-actions - git config user.email github-actions@github.com - git add . - git commit -m "(dev) Built by Publish.jl." - git push diff --git a/.github/workflows/PublishStable.yml b/.github/workflows/PublishStable.yml deleted file mode 100644 index d18b27482..000000000 --- a/.github/workflows/PublishStable.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: PublishStable - -on: - push: - tags: - - '*' - -jobs: - publish: - name: "Publish Documentation (stable)" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/checkout@v2 - with: - ref: gh-pages - path: gh-pages - - uses: julia-actions/setup-julia@latest - with: - version: '1.6' - - name: Install dependencies - run: julia --color=yes --project=. -e 'using Pkg; Pkg.instantiate()' - - name: Build and deploy - run: | - cd gh-pages - julia --color=yes --project=../docs -e "using Pkg; Pkg.instantiate()" - julia --color=yes --project=../docs -e 'include("../docs/make.jl"); build_and_deploy("stable")' - git config user.name github-actions - git config user.email github-actions@github.com - git add . - git commit -m "(stable) Built by Publish.jl." - git push diff --git a/.github/workflows/clean_preview.yml b/.github/workflows/clean_preview.yml new file mode 100644 index 000000000..25946efc3 --- /dev/null +++ b/.github/workflows/clean_preview.yml @@ -0,0 +1,27 @@ +# from https://github.com/CliMA/ClimaTimeSteppers.jl +name: Doc Preview Cleanup + +on: + pull_request: + types: [closed] + +jobs: + doc-preview-cleanup: + runs-on: ubuntu-latest + steps: + - name: Checkout gh-pages branch + uses: actions/checkout@v2 + with: + ref: gh-pages + - name: Delete preview and history + push changes + run: | + if [ -d "previews/PR$PRNUM" ]; then + git config user.name "Documenter.jl" + git config user.email "documenter@juliadocs.github.io" + git rm -rf "previews/PR$PRNUM" + git commit -m "delete preview" + git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree}) + git push --force origin gh-pages-new:gh-pages + fi + env: + PRNUM: ${{ github.event.number }} diff --git a/.github/workflows/pr_comment.yml b/.github/workflows/pr_comment.yml new file mode 100644 index 000000000..0106e9029 --- /dev/null +++ b/.github/workflows/pr_comment.yml @@ -0,0 +1,14 @@ +name: pr_comment +on: + pull_request: + types: [labeled] +jobs: + pr_comment: + runs-on: ubuntu-latest + steps: + - name: Create PR comment + if: github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name && github.event.label.name == 'documentation' # if this is a pull request build AND the pull request is NOT made from a fork + uses: thollander/actions-comment-pull-request@71efef56b184328c7ef1f213577c3a90edaa4aff + with: + message: 'Once the documentation build has completed, you can preview any updated documentation at this URL: https://fluxml.ai/Metalhead.jl/previews/PR${{ github.event.number }}/' + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 487579e25..28008da38 100644 --- a/README.md +++ b/README.md @@ -9,36 +9,36 @@ ## Installation ```julia -]add Metalhead +julia> ]add Metalhead ``` ## Available models -| Model Name | Function | Pre-trained? | -|:-------------------------------------------------|:------------------------------------------------------------------------------------------|:------------:| -| [VGG](https://arxiv.org/abs/1409.1556) | [`VGG`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.VGG.html) | Y (w/o BN) | -| [ResNet](https://arxiv.org/abs/1512.03385) | [`ResNet`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.ResNet.html) | Y | -| [WideResNet](https://arxiv.org/abs/1605.07146) | [`WideResNet`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.WideResNet.html) | Y | -| [GoogLeNet](https://arxiv.org/abs/1409.4842) | [`GoogLeNet`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.GoogLeNet.html) | N | -| [Inception-v3](https://arxiv.org/abs/1512.00567) | [`Inceptionv3`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.Inceptionv3.html) | N | -| [Inception-v4](https://arxiv.org/abs/1602.07261) | [`Inceptionv4`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.Inceptionv4.html) | N | -| [InceptionResNet-v2](https://arxiv.org/abs/1602.07261) | [`Inceptionv3`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.InceptionResNetv2.html) | N | -| [SqueezeNet](https://arxiv.org/abs/1602.07360) | [`SqueezeNet`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.SqueezeNet.html) | Y | -| [DenseNet](https://arxiv.org/abs/1608.06993) | [`DenseNet`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.DenseNet.html) | N | -| [ResNeXt](https://arxiv.org/abs/1611.05431) | [`ResNeXt`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.ResNeXt.html) | Y | -| [MobileNetv1](https://arxiv.org/abs/1704.04861) | [`MobileNetv1`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.MobileNetv1.html) | N | -| [MobileNetv2](https://arxiv.org/abs/1801.04381) | [`MobileNetv2`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.MobileNetv2.html) | N | -| [MobileNetv3](https://arxiv.org/abs/1905.02244) | [`MobileNetv3`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.MobileNetv3.html) | N | -| [EfficientNet](https://arxiv.org/abs/1905.11946) | [`EfficientNet`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.EfficientNet.html) | N | -| [MLPMixer](https://arxiv.org/pdf/2105.01601) | [`MLPMixer`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.MLPMixer.html) | N | -| [ResMLP](https://arxiv.org/abs/2105.03404) | [`ResMLP`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.ResMLP.html) | N | -| [gMLP](https://arxiv.org/abs/2105.08050) | [`gMLP`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.gMLP.html) | N | -| [ViT](https://arxiv.org/abs/2010.11929) | [`ViT`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.ViT.html) | N | -| [ConvNeXt](https://arxiv.org/abs/2201.03545) | [`ConvNeXt`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.ConvNeXt.html) | N | -| [ConvMixer](https://arxiv.org/abs/2201.09792) | [`ConvMixer`](https://fluxml.ai/Metalhead.jl/dev/docstrings/Metalhead.ConvMixer.html) | N | - -To contribute new models, see our [contributing docs](https://fluxml.ai/Metalhead.jl/dev/docs/dev-guide/contributing.html). +| Model Name | Function | Pre-trained? | +|:-------------------------------------------------|:-----------------------------------------------------------------------------------------------|:------------:| +| [VGG](https://arxiv.org/abs/1409.1556) | [`VGG`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.VGG) | Y (w/o BN) | +| [ResNet](https://arxiv.org/abs/1512.03385) | [`ResNet`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.ResNet) | Y | +| [WideResNet](https://arxiv.org/abs/1605.07146) | [`WideResNet`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.WideResNet) | Y | +| [GoogLeNet](https://arxiv.org/abs/1409.4842) | [`GoogLeNet`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.GoogLeNet) | N | +| [Inception-v3](https://arxiv.org/abs/1512.00567) | [`Inceptionv3`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.Inceptionv3) | N | +| [Inception-v4](https://arxiv.org/abs/1602.07261) | [`Inceptionv4`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.Inceptionv4) | N | +| [InceptionResNet-v2](https://arxiv.org/abs/1602.07261) | [`Inceptionv3`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.InceptionResNetv2) | N | +| [SqueezeNet](https://arxiv.org/abs/1602.07360) | [`SqueezeNet`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.SqueezeNet) | Y | +| [DenseNet](https://arxiv.org/abs/1608.06993) | [`DenseNet`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.DenseNet) | N | +| [ResNeXt](https://arxiv.org/abs/1611.05431) | [`ResNeXt`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.ResNeXt) | Y | +| [MobileNetv1](https://arxiv.org/abs/1704.04861) | [`MobileNetv1`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.MobileNetv1) | N | +| [MobileNetv2](https://arxiv.org/abs/1801.04381) | [`MobileNetv2`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.MobileNetv2) | N | +| [MobileNetv3](https://arxiv.org/abs/1905.02244) | [`MobileNetv3`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.MobileNetv3) | N | +| [EfficientNet](https://arxiv.org/abs/1905.11946) | [`EfficientNet`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.EfficientNet) | N | +| [MLPMixer](https://arxiv.org/pdf/2105.01601) | [`MLPMixer`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.MLPMixer) | N | +| [ResMLP](https://arxiv.org/abs/2105.03404) | [`ResMLP`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.ResMLP) | N | +| [gMLP](https://arxiv.org/abs/2105.08050) | [`gMLP`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.gMLP) | N | +| [ViT](https://arxiv.org/abs/2010.11929) | [`ViT`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.ViT) | N | +| [ConvNeXt](https://arxiv.org/abs/2201.03545) | [`ConvNeXt`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.ConvNeXt) | N | +| [ConvMixer](https://arxiv.org/abs/2201.09792) | [`ConvMixer`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.ConvMixer) | N | + +To contribute new models, see our [contributing docs](https://fluxml.ai/Metalhead.jl/latest/contributing/). ## Getting Started -You can find the Metalhead.jl getting started guide [here](https://fluxml.ai/Metalhead.jl/dev/docs/tutorials/quickstart.html). +You can find the Metalhead.jl getting started guide [here](https://fluxml.ai/Metalhead.jl/latest/tutorials/quickstart/). diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 000000000..a303fff20 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,2 @@ +build/ +site/ diff --git a/docs/Project.toml b/docs/Project.toml index e5e6979e1..6335fa0e9 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,6 +1,8 @@ [deps] +Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" DataAugmentation = "88a5189c-e7ff-4f85-ac6b-e6158070f02e" +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c" Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0" -Metalhead = "dbeba491-748d-5e0e-a39e-b530a07fa0cc" -Publish = "f065f642-d108-4f50-8aa5-6749150a895a" +LazyArtifacts = "4af54fe1-eca0-43a8-85a7-787d91b784e3" +OneHotArrays = "0b1bfda6-eb8a-41d2-88d8-f5af5cad476f" diff --git a/docs/make.jl b/docs/make.jl index f5d29f7e9..092b29672 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,17 +1,29 @@ -using Pkg +using Documenter, Metalhead, Artifacts, LazyArtifacts, Images, OneHotArrays, DataAugmentation, Flux -Pkg.develop(; path = "..") +DocMeta.setdocmeta!(Metalhead, :DocTestSetup, :(using Metalhead); recursive = true) -using Publish -using Artifacts, LazyArtifacts -using Metalhead +makedocs(modules = [Metalhead, Artifacts, LazyArtifacts, Images, OneHotArrays, DataAugmentation, Flux], + sitename = "Metalhead.jl", + doctest = false, + pages = ["Home" => "index.md", + "Tutorials" => [ + "tutorials/quickstart.md", + ], + "Developer guide" => "contributing.md", + "API reference" => [ + "api/models.md", + ], + ], + # format = Documenter.HTML( + # canonical = "https://fluxml.ai/Metalhead.jl/stable/", + # analytics = "UA-36890222-9", + # assets = ["assets/flux.css"], + # prettyurls = get(ENV, "CI", nothing) == "true"), + # ) -# override default theme -cp(artifact"flux-theme", "../_flux-theme"; force = true) - -p = Publish.Project(Metalhead) - -function build_and_deploy(label) - rm(label; recursive = true, force = true) - return deploy(Metalhead; root = "/Metalhead.jl", label = label) -end +deploydocs( + # repo = "github.com/FluxML/Metalhead.jl.git", + devurl = "latest", + versions = ["stable" => "v^", "v#.#.#", "latest" => "latest"], + target = "build", + push_preview = true) diff --git a/docs/serve.jl b/docs/serve.jl deleted file mode 100644 index bf4a51179..000000000 --- a/docs/serve.jl +++ /dev/null @@ -1,17 +0,0 @@ -using Pkg - -Pkg.develop(; path = "..") - -using Revise -using Publish -using Artifacts, LazyArtifacts - -using Metalhead - -# override default theme -cp(artifact"flux-theme", "../_flux-theme"; force = true) - -p = Publish.Project(Metalhead) - -# serve documentation -serve(Metalhead) diff --git a/docs/src/api/models.md b/docs/src/api/models.md new file mode 100644 index 000000000..1b81acba0 --- /dev/null +++ b/docs/src/api/models.md @@ -0,0 +1,30 @@ +```@meta +CurrentModule = Metalhead +``` + +# Models + +The API reference for available models in `Metalhead.jl`. + +```@docs +VGG +ResNet +WideResNet +GoogLeNet +Inception-v3 +Inception-v4 +InceptionResNet-v2 +SqueezeNet +DenseNet +ResNeXt +MobileNetv1 +MobileNetv2 +MobileNetv3 +EfficientNet +MLPMixer +ResMLP +gMLP +ViT +ConvNeXt +ConvMixer +``` diff --git a/docs/src/assets/flux.css b/docs/src/assets/flux.css new file mode 100644 index 000000000..541ead5fe --- /dev/null +++ b/docs/src/assets/flux.css @@ -0,0 +1,113 @@ +@import url('https://fonts.googleapis.com/css?family=Lato:400,400i'); + +body { + font-family: Lato, "Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif; +} + +nav.toc { + padding-top: 0; + background: rgb(240, 240, 240); + line-height: 2em; + cursor: default; + user-select: none; +} + +h1+h2 { + margin-top: 0; +} + +/* Green banner in ToC */ +nav.toc > h1 { + margin-top: 0; + padding-top: 0.4em; + padding-bottom: 0.5em; + border-bottom: 5px solid white; + box-shadow: 0px -2px 5px rgb(60,60,60); + margin-bottom: 0.5em; + background: rgb(60, 150, 60); + + font-style: italic; + font-weight: normal; + font-size: 50pt; + text-transform: lowercase; + text-shadow: 2px 2px 5px rgba(0,0,0,0.2); + color: white; +} + +/* Reduce ToC font size */ +.toctext { + font-size: 10pt; +} + +/* Fade out non-clickable ToC headers */ +nav.toc ul span.toctext { + color: rgb(180, 180, 180); +} + +nav.toc ul .toctext { + color: rgb(100, 100, 100); +} + +nav.toc ul a.toctext:hover { + color: inherit; + background: rgb(220, 220, 220); + cursor: default; +} + +nav.toc li.current > .toctext { + background: linear-gradient(90deg, rgb(245,245,245) 0%, white 90%); + font-weight: normal; +} + +nav.toc ul.internal li.toplevel { + font-weight: normal; +} + +/* Content */ + +article { max-width: none; } + +article > p, article > ul { + max-width: 45em; +} + +/* Links */ +a, a:visited { color: rgb(0, 120, 0); } +article p a { border-bottom: 1px solid rgb(200, 230, 200); } +a:hover, a:visited:hover { color: rgb(0, 80, 0); } + +/* Article Links */ +article p a { border-bottom: 1px solid rgb(200, 230, 200); } +article p a:hover, article a:visited:hover { color: rgb(0, 120, 0); } +article p a:hover { border-bottom: 1px solid rgb(150, 200, 150); } + +/* Doctstrings */ +article section.docstring { + padding: 0.5em 0; + border-left: none; + border-right: none; + border-bottom: none; +} + +/* Code */ + +article pre, article p > code { + background: rgb(245, 250, 245); +} + +article pre { + border: none; + max-width: none; + padding: 1em; + border-radius: 10px 0px 0px 10px; + margin-left: -1em; + margin-right: -2em; +} + +.hljs-comment { + font-style: italic; +} + +.hljs-number { + color: rgb(0, 150, 150); +} diff --git a/docs/dev-guide/contributing.md b/docs/src/contributing.md similarity index 100% rename from docs/dev-guide/contributing.md rename to docs/src/contributing.md diff --git a/docs/src/index.md b/docs/src/index.md new file mode 100644 index 000000000..920cb8ba0 --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1,44 @@ +```@meta +CurrentModule = Metalhead +``` + +# Metalhead + +[Metalhead.jl](https://github.com/FluxML/Metalhead.jl) provides standard machine learning vision models for use with [Flux.jl](https://fluxml.ai). The architectures in this package make use of pure Flux layers, and they represent the best-practices for creating modules like residual blocks, inception blocks, etc. in Flux. Metalhead also provides some building blocks for more complex models in the Layers module. + +## Installation + +```julia +julia> ]add Metalhead +``` + +## Available models + +| Model Name | Function | Pre-trained? | +|:-------------------------------------------------------|:----------------------------|:------------:| +| [VGG](https://arxiv.org/abs/1409.1556) | [`VGG`](@ref) | Y (w/o BN) | +| [ResNet](https://arxiv.org/abs/1512.03385) | [`ResNet`](@ref) | Y | +| [WideResNet](https://arxiv.org/abs/1605.07146) | [`WideResNet`](@ref) | Y | +| [GoogLeNet](https://arxiv.org/abs/1409.4842) | [`GoogLeNet`](@ref) | N | +| [Inception-v3](https://arxiv.org/abs/1512.00567) | [`Inceptionv3`](@ref) | N | +| [Inception-v4](https://arxiv.org/abs/1602.07261) | [`Inceptionv4`](@ref) | N | +| [InceptionResNet-v2](https://arxiv.org/abs/1602.07261) | [`Inceptionv3`](@ref) | N | +| [SqueezeNet](https://arxiv.org/abs/1602.07360) | [`SqueezeNet`](@ref) | Y | +| [DenseNet](https://arxiv.org/abs/1608.06993) | [`DenseNet`](@ref) | N | +| [ResNeXt](https://arxiv.org/abs/1611.05431) | [`ResNeXt`](@ref) | Y | +| [MobileNetv1](https://arxiv.org/abs/1704.04861) | [`MobileNetv1`](@ref) | N | +| [MobileNetv2](https://arxiv.org/abs/1801.04381) | [`MobileNetv2`](@ref) | N | +| [MobileNetv3](https://arxiv.org/abs/1905.02244) | [`MobileNetv3`](@ref) | N | +| [EfficientNet](https://arxiv.org/abs/1905.11946) | [`EfficientNet`](@ref) | N | +| [MLPMixer](https://arxiv.org/pdf/2105.01601) | [`MLPMixer`](@ref) | N | +| [ResMLP](https://arxiv.org/abs/2105.03404) | [`ResMLP`](@ref) | N | +| [gMLP](https://arxiv.org/abs/2105.08050) | [`gMLP`](@ref) | N | +| [ViT](https://arxiv.org/abs/2010.11929) | [`ViT`](@ref) | N | +| [ConvNeXt](https://arxiv.org/abs/2201.03545) | [`ConvNeXt`](@ref) | N | +| [ConvMixer](https://arxiv.org/abs/2201.09792) | [`ConvMixer`](@ref) | N | + +To contribute new models, see our [contributing docs](@ref Contributing-to-Metalhead.jl). + +## Getting Started + +You can find the Metalhead.jl getting started guide [here](@ref Quickstart). diff --git a/docs/tutorials/quickstart.md b/docs/src/tutorials/quickstart.md similarity index 88% rename from docs/tutorials/quickstart.md rename to docs/src/tutorials/quickstart.md index cfb99eb72..a7783d860 100644 --- a/docs/tutorials/quickstart.md +++ b/docs/src/tutorials/quickstart.md @@ -1,6 +1,5 @@ # Quickstart -{cell=quickstart, display=false, output=false, results=false} ```julia using Flux, Metalhead ``` @@ -16,7 +15,6 @@ model = ResNet(18; pretrain = true) Now, we can use this model with Flux like any other model. First, let's check the accuracy on a test image from ImageNet. -{cell=quickstart} ```julia using Images @@ -24,9 +22,8 @@ using Images img = Images.load(download("https://cdn.pixabay.com/photo/2015/05/07/11/02/guitar-756326_960_720.jpg")); ``` We'll use the popular [DataAugmentation.jl](https://github.com/lorenzoh/DataAugmentation.jl) library to crop our input image, convert it to a plain array, and normalize the pixels. -{cell=quickstart} ```julia -using DataAugmentation +using DataAugmentation, OneHotArrays DATA_MEAN = (0.485, 0.456, 0.406) DATA_STD = (0.229, 0.224, 0.225) @@ -39,13 +36,13 @@ data = apply(augmentations, Image(img)) |> itemdata # image net labels labels = readlines(download("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt")) -Flux.onecold(model(Flux.unsqueeze(data, 4)), labels) +onecold(model(Flux.unsqueeze(data, 4)), labels) ``` Below, we train it on some randomly generated data. ```julia -using Flux: onehotbatch +using OneHotArrays: onehotbatch batchsize = 1 data = [(rand(Float32, 224, 224, 3, batchsize), onehotbatch(rand(1:1000, batchsize), 1:1000)) diff --git a/toc.md b/toc.md deleted file mode 100644 index c2599e837..000000000 --- a/toc.md +++ /dev/null @@ -1,11 +0,0 @@ -[Introduction](README.md) - -# Tutorials - -* [Quickstart](docs/tutorials/quickstart.md) - -# Developer guide - -* [Contributing](docs/dev-guide/contributing.md) - -[API Reference](docstrings.md) \ No newline at end of file From 6433f27dade4a0f803ad947e7f5f1e22d6abffcd Mon Sep 17 00:00:00 2001 From: Saransh Date: Fri, 12 Aug 2022 18:25:56 +0530 Subject: [PATCH 02/10] Fix syntactical errors --- docs/make.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 092b29672..46bb4ae16 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -19,10 +19,9 @@ makedocs(modules = [Metalhead, Artifacts, LazyArtifacts, Images, OneHotArrays, D # analytics = "UA-36890222-9", # assets = ["assets/flux.css"], # prettyurls = get(ENV, "CI", nothing) == "true"), - # ) + ) -deploydocs( - # repo = "github.com/FluxML/Metalhead.jl.git", +deploydocs(repo = "github.com/Saransh-cpp/Metalhead.jl.git", devurl = "latest", versions = ["stable" => "v^", "v#.#.#", "latest" => "latest"], target = "build", From ce6c3e4fe721b219306b1ffa4ec9ac41ced55926 Mon Sep 17 00:00:00 2001 From: Saransh Date: Fri, 12 Aug 2022 18:41:16 +0530 Subject: [PATCH 03/10] Add assets, prettyurls --- docs/make.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 46bb4ae16..4da543571 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -14,11 +14,11 @@ makedocs(modules = [Metalhead, Artifacts, LazyArtifacts, Images, OneHotArrays, D "api/models.md", ], ], - # format = Documenter.HTML( - # canonical = "https://fluxml.ai/Metalhead.jl/stable/", - # analytics = "UA-36890222-9", - # assets = ["assets/flux.css"], - # prettyurls = get(ENV, "CI", nothing) == "true"), + format = Documenter.HTML( + # canonical = "https://fluxml.ai/Metalhead.jl/stable/", + # analytics = "UA-36890222-9", + assets = ["assets/flux.css"], + prettyurls = get(ENV, "CI", nothing) == "true"), ) deploydocs(repo = "github.com/Saransh-cpp/Metalhead.jl.git", From 0a0d4c53a9e4baaa1974deed381ca7a6b9788d7c Mon Sep 17 00:00:00 2001 From: Saransh Date: Fri, 12 Aug 2022 19:08:53 +0530 Subject: [PATCH 04/10] Final touches --- docs/make.jl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 4da543571..8f4cf17e4 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -15,14 +15,12 @@ makedocs(modules = [Metalhead, Artifacts, LazyArtifacts, Images, OneHotArrays, D ], ], format = Documenter.HTML( - # canonical = "https://fluxml.ai/Metalhead.jl/stable/", + canonical = "https://fluxml.ai/Metalhead.jl/stable/", # analytics = "UA-36890222-9", assets = ["assets/flux.css"], prettyurls = get(ENV, "CI", nothing) == "true"), ) -deploydocs(repo = "github.com/Saransh-cpp/Metalhead.jl.git", - devurl = "latest", - versions = ["stable" => "v^", "v#.#.#", "latest" => "latest"], +deploydocs(repo = "github.com/FluxML/Metalhead.jl.git", target = "build", push_preview = true) From ef4ccec28640739063c4b41bbbdbd97c0710c021 Mon Sep 17 00:00:00 2001 From: Saransh Date: Fri, 12 Aug 2022 19:33:29 +0530 Subject: [PATCH 05/10] Final final touches --- .github/workflows/CI.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index cd490d637..353819673 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,6 +9,12 @@ on: - master tags: '*' +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + jobs: test: name: ${{ matrix.suite }} - Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} @@ -118,4 +124,4 @@ jobs: - run: julia --project=docs docs/make.jl env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} From 23cca489609f45c83b434ad1e7dc0c907be133fc Mon Sep 17 00:00:00 2001 From: Saransh Date: Tue, 23 Aug 2022 22:54:08 +0530 Subject: [PATCH 06/10] Use `@autodocs` and fix references --- docs/make.jl | 2 +- docs/src/api/models.md | 30 ------------------------------ docs/src/api/reference.md | 14 ++++++++++++++ docs/src/tutorials/quickstart.md | 1 - src/convnets/alexnet.jl | 2 +- src/convnets/convnext.jl | 12 ++++++++++-- src/convnets/resnets/core.jl | 8 ++++++++ src/convnets/resnets/resnet.jl | 4 ++++ src/convnets/resnets/seresnet.jl | 4 ++++ src/convnets/squeezenet.jl | 2 +- 10 files changed, 43 insertions(+), 36 deletions(-) delete mode 100644 docs/src/api/models.md create mode 100644 docs/src/api/reference.md diff --git a/docs/make.jl b/docs/make.jl index 8f4cf17e4..72fb486c9 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -11,7 +11,7 @@ makedocs(modules = [Metalhead, Artifacts, LazyArtifacts, Images, OneHotArrays, D ], "Developer guide" => "contributing.md", "API reference" => [ - "api/models.md", + "api/reference.md", ], ], format = Documenter.HTML( diff --git a/docs/src/api/models.md b/docs/src/api/models.md deleted file mode 100644 index 1b81acba0..000000000 --- a/docs/src/api/models.md +++ /dev/null @@ -1,30 +0,0 @@ -```@meta -CurrentModule = Metalhead -``` - -# Models - -The API reference for available models in `Metalhead.jl`. - -```@docs -VGG -ResNet -WideResNet -GoogLeNet -Inception-v3 -Inception-v4 -InceptionResNet-v2 -SqueezeNet -DenseNet -ResNeXt -MobileNetv1 -MobileNetv2 -MobileNetv3 -EfficientNet -MLPMixer -ResMLP -gMLP -ViT -ConvNeXt -ConvMixer -``` diff --git a/docs/src/api/reference.md b/docs/src/api/reference.md new file mode 100644 index 000000000..102db29f1 --- /dev/null +++ b/docs/src/api/reference.md @@ -0,0 +1,14 @@ +# API Reference + +The API reference of `Metalhead.jl`. + +**Note**: + +```@autodocs +Modules = [Metalhead] +``` + +```@docs +Metalhead.squeeze_excite +Metalhead.LayerScale +``` diff --git a/docs/src/tutorials/quickstart.md b/docs/src/tutorials/quickstart.md index a7783d860..7b3075264 100644 --- a/docs/src/tutorials/quickstart.md +++ b/docs/src/tutorials/quickstart.md @@ -5,7 +5,6 @@ using Flux, Metalhead ``` Using a model from Metalhead is as simple as selecting a model from the table of [available models](@ref). For example, below we use the pre-trained ResNet-18 model. -{cell=quickstart} ```julia using Flux, Metalhead diff --git a/src/convnets/alexnet.jl b/src/convnets/alexnet.jl index 51cfbf029..fba6749e4 100644 --- a/src/convnets/alexnet.jl +++ b/src/convnets/alexnet.jl @@ -45,7 +45,7 @@ Create a `AlexNet`. `AlexNet` does not currently support pretrained weights. -See also [`Metalhead.alexnet`](@ref). +See also [`alexnet`](@ref). """ struct AlexNet layers::Any diff --git a/src/convnets/convnext.jl b/src/convnets/convnext.jl index 30b314556..0f17b39cb 100644 --- a/src/convnets/convnext.jl +++ b/src/convnets/convnext.jl @@ -7,8 +7,8 @@ Creates a single block of ConvNeXt. # Arguments - `planes`: number of input channels. - - `stochastic_depth_prob`: Stochastic depth probability. - - `layerscale_init`: Initial value for [`LayerScale`](@ref) + - `drop_path_rate`: Stochastic depth rate. + - `layerscale_init`: Initial value for [`Metalhead.LayerScale`](@ref) """ function convnextblock(planes::Integer, stochastic_depth_prob = 0.0, layerscale_init = 1.0f-6) @@ -33,8 +33,13 @@ Creates the layers for a ConvNeXt model. - `depths`: list with configuration for depth of each block - `planes`: list with configuration for number of output channels in each block +<<<<<<< HEAD - `stochastic_depth_prob`: Stochastic depth probability. - `layerscale_init`: Initial value for [`LayerScale`](@ref) +======= + - `drop_path_rate`: Stochastic depth rate. + - `layerscale_init`: Initial value for [`Metalhead.LayerScale`](@ref) +>>>>>>> 5ac81ce (Use `@autodocs` and fix references) ([reference](https://arxiv.org/abs/2103.17239)) - `inchannels`: number of input channels. - `nclasses`: number of output classes @@ -96,10 +101,13 @@ Creates a ConvNeXt model. - `inchannels`: number of input channels - `nclasses`: number of output classes +<<<<<<< HEAD !!! warning `ConvNeXt` does not currently support pretrained weights. +======= +>>>>>>> 5ac81ce (Use `@autodocs` and fix references) See also [`Metalhead.convnext`](@ref). """ struct ConvNeXt diff --git a/src/convnets/resnets/core.jl b/src/convnets/resnets/core.jl index c5b2f1c7d..ba8899e12 100644 --- a/src/convnets/resnets/core.jl +++ b/src/convnets/resnets/core.jl @@ -66,7 +66,11 @@ used to build the block for the model, see [`Metalhead.bottleneck_builder`](@ref - `revnorm`: set to `true` to place the normalisation layer before the convolution - `drop_block`: the drop block layer - `drop_path`: the drop path layer +<<<<<<< HEAD - `attn_fn`: the attention function to use. See [`squeeze_excite`](@ref) for an example. +======= + - `attn_fn`: the attention function to use. See [`Metalhead.squeeze_excite`](@ref) for an example. +>>>>>>> 5ac81ce (Use `@autodocs` and fix references) """ function bottleneck(inplanes::Integer, planes::Integer; stride::Integer, cardinality::Integer = 1, base_width::Integer = 64, @@ -231,7 +235,11 @@ const RESNET_SHORTCUTS = Dict(:A => (downsample_identity, downsample_identity), resnet_stem(; stem_type = :default, inchannels::Integer = 3, replace_stem_pool = false, norm_layer = BatchNorm, activation = relu) +<<<<<<< HEAD Builds a stem to be used in a ResNet model. See the `stem` argument of [`resnet`](@ref) for details +======= +Builds a stem to be used in a ResNet model. See the `stem` argument of [`Metalhead.resnet`](@ref) for details +>>>>>>> 5ac81ce (Use `@autodocs` and fix references) on how to use this function. # Arguments diff --git a/src/convnets/resnets/resnet.jl b/src/convnets/resnets/resnet.jl index a8c12eda8..62a441d73 100644 --- a/src/convnets/resnets/resnet.jl +++ b/src/convnets/resnets/resnet.jl @@ -48,7 +48,11 @@ The number of channels in outer 1x1 convolutions is the same. - `inchannels`: The number of input channels. - `nclasses`: The number of output classes +<<<<<<< HEAD Advanced users who want more configuration options will be better served by using [`resnet`](@ref). +======= +Advanced users who want more configuration options will be better served by using [`Metalhead.resnet`](@ref). +>>>>>>> 5ac81ce (Use `@autodocs` and fix references) """ struct WideResNet layers::Any diff --git a/src/convnets/resnets/seresnet.jl b/src/convnets/resnets/seresnet.jl index 44e32083d..83d6cb711 100644 --- a/src/convnets/resnets/seresnet.jl +++ b/src/convnets/resnets/seresnet.jl @@ -58,7 +58,11 @@ Creates a SEResNeXt model with the specified depth, cardinality, and base width. `SEResNeXt` does not currently support pretrained weights. +<<<<<<< HEAD Advanced users who want more configuration options will be better served by using [`resnet`](@ref). +======= +Advanced users who want more configuration options will be better served by using [`Metalhead.resnet`](@ref). +>>>>>>> 5ac81ce (Use `@autodocs` and fix references) """ struct SEResNeXt layers::Any diff --git a/src/convnets/squeezenet.jl b/src/convnets/squeezenet.jl index 5d63a565d..1e90dd55c 100644 --- a/src/convnets/squeezenet.jl +++ b/src/convnets/squeezenet.jl @@ -63,7 +63,7 @@ Create a SqueezeNet - `inchannels`: number of input channels. - `nclasses`: the number of output classes. -See also [`Metalhead.squeezenet`](@ref). +See also [`squeezenet`](@ref). """ struct SqueezeNet layers::Any From b44e11c1dbf22bf36d4923c416ec18748e3d96a9 Mon Sep 17 00:00:00 2001 From: Saransh Date: Fri, 26 Aug 2022 22:12:58 +0530 Subject: [PATCH 07/10] Forgot the note --- docs/src/api/reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/api/reference.md b/docs/src/api/reference.md index 102db29f1..01c20ed8b 100644 --- a/docs/src/api/reference.md +++ b/docs/src/api/reference.md @@ -2,7 +2,7 @@ The API reference of `Metalhead.jl`. -**Note**: +**Note**: This page is still in progress. ```@autodocs Modules = [Metalhead] From d844d00fbf9f8cef343dd5bc2d1222ddda2980d9 Mon Sep 17 00:00:00 2001 From: Saransh Date: Mon, 5 Sep 2022 19:56:38 +0530 Subject: [PATCH 08/10] Fix more cross-references --- docs/src/api/reference.md | 3 +++ docs/src/tutorials/quickstart.md | 2 +- src/convnets/builders/mbconv.jl | 2 +- src/utilities.jl | 4 ---- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/src/api/reference.md b/docs/src/api/reference.md index 01c20ed8b..1699e81fe 100644 --- a/docs/src/api/reference.md +++ b/docs/src/api/reference.md @@ -9,6 +9,9 @@ Modules = [Metalhead] ``` ```@docs +Metalhead.create_classifier Metalhead.squeeze_excite Metalhead.LayerScale +Metalhead.DropBlock +Metalhead.StochasticDepth ``` diff --git a/docs/src/tutorials/quickstart.md b/docs/src/tutorials/quickstart.md index 7b3075264..a00854627 100644 --- a/docs/src/tutorials/quickstart.md +++ b/docs/src/tutorials/quickstart.md @@ -4,7 +4,7 @@ using Flux, Metalhead ``` -Using a model from Metalhead is as simple as selecting a model from the table of [available models](@ref). For example, below we use the pre-trained ResNet-18 model. +Using a model from Metalhead is as simple as selecting a model from the table of [available models](@ref API-Reference). For example, below we use the pre-trained ResNet-18 model. ```julia using Flux, Metalhead diff --git a/src/convnets/builders/mbconv.jl b/src/convnets/builders/mbconv.jl index 7b68be300..2f2dadfdb 100644 --- a/src/convnets/builders/mbconv.jl +++ b/src/convnets/builders/mbconv.jl @@ -6,7 +6,7 @@ Creates a block builder for `irblockfn` within a given stage. Note that this function is not intended to be called directly, but instead passed to -[`mbconv_stage_builder`](@ref) which will return a builder over all stages. +[`Metalhead.mbconv_stage_builder`](@ref) which will return a builder over all stages. Users wanting to provide a custom inverted residual block type can extend this function by defining `invresbuilder(::typeof(my_block), ...)`. """ diff --git a/src/utilities.jl b/src/utilities.jl index 6f97e81d2..9f54107fd 100644 --- a/src/utilities.jl +++ b/src/utilities.jl @@ -15,8 +15,6 @@ end Convenience function for applying an activation function to the output after summing up the input arrays. Useful as the `connection` argument for the block function in [`resnet`](@ref). - -See also [`reluadd`](@ref). """ addact(activation = relu, xs...) = activation(sum(xs)) @@ -26,8 +24,6 @@ addact(activation = relu, xs...) = activation(sum(xs)) Convenience function for adding input arrays after applying an activation function to them. Useful as the `connection` argument for the block function in [`resnet`](@ref). - -See also [`addrelu`](@ref). """ actadd(activation = relu, xs...) = sum(activation.(x) for x in xs) From 3277ffb39b92b734af1b38b4adcb38912729aab7 Mon Sep 17 00:00:00 2001 From: Saransh Date: Mon, 5 Sep 2022 20:00:49 +0530 Subject: [PATCH 09/10] Update links in README --- README.md | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 28008da38..da77712d1 100644 --- a/README.md +++ b/README.md @@ -16,26 +16,26 @@ julia> ]add Metalhead | Model Name | Function | Pre-trained? | |:-------------------------------------------------|:-----------------------------------------------------------------------------------------------|:------------:| -| [VGG](https://arxiv.org/abs/1409.1556) | [`VGG`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.VGG) | Y (w/o BN) | -| [ResNet](https://arxiv.org/abs/1512.03385) | [`ResNet`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.ResNet) | Y | -| [WideResNet](https://arxiv.org/abs/1605.07146) | [`WideResNet`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.WideResNet) | Y | -| [GoogLeNet](https://arxiv.org/abs/1409.4842) | [`GoogLeNet`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.GoogLeNet) | N | -| [Inception-v3](https://arxiv.org/abs/1512.00567) | [`Inceptionv3`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.Inceptionv3) | N | -| [Inception-v4](https://arxiv.org/abs/1602.07261) | [`Inceptionv4`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.Inceptionv4) | N | -| [InceptionResNet-v2](https://arxiv.org/abs/1602.07261) | [`Inceptionv3`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.InceptionResNetv2) | N | -| [SqueezeNet](https://arxiv.org/abs/1602.07360) | [`SqueezeNet`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.SqueezeNet) | Y | -| [DenseNet](https://arxiv.org/abs/1608.06993) | [`DenseNet`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.DenseNet) | N | -| [ResNeXt](https://arxiv.org/abs/1611.05431) | [`ResNeXt`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.ResNeXt) | Y | -| [MobileNetv1](https://arxiv.org/abs/1704.04861) | [`MobileNetv1`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.MobileNetv1) | N | -| [MobileNetv2](https://arxiv.org/abs/1801.04381) | [`MobileNetv2`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.MobileNetv2) | N | -| [MobileNetv3](https://arxiv.org/abs/1905.02244) | [`MobileNetv3`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.MobileNetv3) | N | -| [EfficientNet](https://arxiv.org/abs/1905.11946) | [`EfficientNet`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.EfficientNet) | N | -| [MLPMixer](https://arxiv.org/pdf/2105.01601) | [`MLPMixer`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.MLPMixer) | N | -| [ResMLP](https://arxiv.org/abs/2105.03404) | [`ResMLP`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.ResMLP) | N | -| [gMLP](https://arxiv.org/abs/2105.08050) | [`gMLP`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.gMLP) | N | -| [ViT](https://arxiv.org/abs/2010.11929) | [`ViT`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.ViT) | N | -| [ConvNeXt](https://arxiv.org/abs/2201.03545) | [`ConvNeXt`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.ConvNeXt) | N | -| [ConvMixer](https://arxiv.org/abs/2201.09792) | [`ConvMixer`](https://fluxml.ai/Metalhead.jl/stable/api/models.html#Metalhead.ConvMixer) | N | +| [VGG](https://arxiv.org/abs/1409.1556) | [`VGG`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.VGG) | Y (w/o BN) | +| [ResNet](https://arxiv.org/abs/1512.03385) | [`ResNet`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.ResNet) | Y | +| [WideResNet](https://arxiv.org/abs/1605.07146) | [`WideResNet`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.WideResNet) | Y | +| [GoogLeNet](https://arxiv.org/abs/1409.4842) | [`GoogLeNet`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.GoogLeNet) | N | +| [Inception-v3](https://arxiv.org/abs/1512.00567) | [`Inceptionv3`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.Inceptionv3) | N | +| [Inception-v4](https://arxiv.org/abs/1602.07261) | [`Inceptionv4`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.Inceptionv4) | N | +| [InceptionResNet-v2](https://arxiv.org/abs/1602.07261) | [`Inceptionv3`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.InceptionResNetv2) | N | +| [SqueezeNet](https://arxiv.org/abs/1602.07360) | [`SqueezeNet`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.SqueezeNet) | Y | +| [DenseNet](https://arxiv.org/abs/1608.06993) | [`DenseNet`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.DenseNet) | N | +| [ResNeXt](https://arxiv.org/abs/1611.05431) | [`ResNeXt`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.ResNeXt) | Y | +| [MobileNetv1](https://arxiv.org/abs/1704.04861) | [`MobileNetv1`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.MobileNetv1) | N | +| [MobileNetv2](https://arxiv.org/abs/1801.04381) | [`MobileNetv2`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.MobileNetv2) | N | +| [MobileNetv3](https://arxiv.org/abs/1905.02244) | [`MobileNetv3`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.MobileNetv3) | N | +| [EfficientNet](https://arxiv.org/abs/1905.11946) | [`EfficientNet`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.EfficientNet) | N | +| [MLPMixer](https://arxiv.org/pdf/2105.01601) | [`MLPMixer`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.MLPMixer) | N | +| [ResMLP](https://arxiv.org/abs/2105.03404) | [`ResMLP`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.ResMLP) | N | +| [gMLP](https://arxiv.org/abs/2105.08050) | [`gMLP`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.gMLP) | N | +| [ViT](https://arxiv.org/abs/2010.11929) | [`ViT`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.ViT) | N | +| [ConvNeXt](https://arxiv.org/abs/2201.03545) | [`ConvNeXt`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.ConvNeXt) | N | +| [ConvMixer](https://arxiv.org/abs/2201.09792) | [`ConvMixer`](https://fluxml.ai/Metalhead.jl/stable/api/reference.html#Metalhead.ConvMixer) | N | To contribute new models, see our [contributing docs](https://fluxml.ai/Metalhead.jl/latest/contributing/). From c3f0c603d16e8533f9592e9e298442fd93bc5e01 Mon Sep 17 00:00:00 2001 From: Saransh Date: Mon, 5 Sep 2022 20:09:42 +0530 Subject: [PATCH 10/10] Rebase errors --- src/convnets/convnext.jl | 10 +--------- src/convnets/resnets/core.jl | 8 -------- src/convnets/resnets/resnet.jl | 4 ---- src/convnets/resnets/seresnet.jl | 4 ---- 4 files changed, 1 insertion(+), 25 deletions(-) diff --git a/src/convnets/convnext.jl b/src/convnets/convnext.jl index 0f17b39cb..a38840d0b 100644 --- a/src/convnets/convnext.jl +++ b/src/convnets/convnext.jl @@ -7,7 +7,7 @@ Creates a single block of ConvNeXt. # Arguments - `planes`: number of input channels. - - `drop_path_rate`: Stochastic depth rate. + - `stochastic_depth_prob`: Stochastic depth probability. - `layerscale_init`: Initial value for [`Metalhead.LayerScale`](@ref) """ function convnextblock(planes::Integer, stochastic_depth_prob = 0.0, @@ -33,13 +33,8 @@ Creates the layers for a ConvNeXt model. - `depths`: list with configuration for depth of each block - `planes`: list with configuration for number of output channels in each block -<<<<<<< HEAD - `stochastic_depth_prob`: Stochastic depth probability. - `layerscale_init`: Initial value for [`LayerScale`](@ref) -======= - - `drop_path_rate`: Stochastic depth rate. - - `layerscale_init`: Initial value for [`Metalhead.LayerScale`](@ref) ->>>>>>> 5ac81ce (Use `@autodocs` and fix references) ([reference](https://arxiv.org/abs/2103.17239)) - `inchannels`: number of input channels. - `nclasses`: number of output classes @@ -101,13 +96,10 @@ Creates a ConvNeXt model. - `inchannels`: number of input channels - `nclasses`: number of output classes -<<<<<<< HEAD !!! warning `ConvNeXt` does not currently support pretrained weights. -======= ->>>>>>> 5ac81ce (Use `@autodocs` and fix references) See also [`Metalhead.convnext`](@ref). """ struct ConvNeXt diff --git a/src/convnets/resnets/core.jl b/src/convnets/resnets/core.jl index ba8899e12..c5b2f1c7d 100644 --- a/src/convnets/resnets/core.jl +++ b/src/convnets/resnets/core.jl @@ -66,11 +66,7 @@ used to build the block for the model, see [`Metalhead.bottleneck_builder`](@ref - `revnorm`: set to `true` to place the normalisation layer before the convolution - `drop_block`: the drop block layer - `drop_path`: the drop path layer -<<<<<<< HEAD - `attn_fn`: the attention function to use. See [`squeeze_excite`](@ref) for an example. -======= - - `attn_fn`: the attention function to use. See [`Metalhead.squeeze_excite`](@ref) for an example. ->>>>>>> 5ac81ce (Use `@autodocs` and fix references) """ function bottleneck(inplanes::Integer, planes::Integer; stride::Integer, cardinality::Integer = 1, base_width::Integer = 64, @@ -235,11 +231,7 @@ const RESNET_SHORTCUTS = Dict(:A => (downsample_identity, downsample_identity), resnet_stem(; stem_type = :default, inchannels::Integer = 3, replace_stem_pool = false, norm_layer = BatchNorm, activation = relu) -<<<<<<< HEAD Builds a stem to be used in a ResNet model. See the `stem` argument of [`resnet`](@ref) for details -======= -Builds a stem to be used in a ResNet model. See the `stem` argument of [`Metalhead.resnet`](@ref) for details ->>>>>>> 5ac81ce (Use `@autodocs` and fix references) on how to use this function. # Arguments diff --git a/src/convnets/resnets/resnet.jl b/src/convnets/resnets/resnet.jl index 62a441d73..a8c12eda8 100644 --- a/src/convnets/resnets/resnet.jl +++ b/src/convnets/resnets/resnet.jl @@ -48,11 +48,7 @@ The number of channels in outer 1x1 convolutions is the same. - `inchannels`: The number of input channels. - `nclasses`: The number of output classes -<<<<<<< HEAD Advanced users who want more configuration options will be better served by using [`resnet`](@ref). -======= -Advanced users who want more configuration options will be better served by using [`Metalhead.resnet`](@ref). ->>>>>>> 5ac81ce (Use `@autodocs` and fix references) """ struct WideResNet layers::Any diff --git a/src/convnets/resnets/seresnet.jl b/src/convnets/resnets/seresnet.jl index 83d6cb711..44e32083d 100644 --- a/src/convnets/resnets/seresnet.jl +++ b/src/convnets/resnets/seresnet.jl @@ -58,11 +58,7 @@ Creates a SEResNeXt model with the specified depth, cardinality, and base width. `SEResNeXt` does not currently support pretrained weights. -<<<<<<< HEAD Advanced users who want more configuration options will be better served by using [`resnet`](@ref). -======= -Advanced users who want more configuration options will be better served by using [`Metalhead.resnet`](@ref). ->>>>>>> 5ac81ce (Use `@autodocs` and fix references) """ struct SEResNeXt layers::Any