Skip to content

Commit

Permalink
Drops timm, fixes docs (#63)
Browse files Browse the repository at this point in the history
* drops timm, fixes docs

* drops timm

* tries fixing docs

* patch up docs

* final try for docs

* fixes

* one more chance
  • Loading branch information
oke-aditya authored Dec 2, 2020
1 parent 11f5c83 commit e7b075e
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 59 deletions.
21 changes: 6 additions & 15 deletions .github/workflows/sphinx-docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,10 @@ jobs:
with:
# git is required to clone the docs theme
# before custom requirement are resolved https://github.com/ammaraskar/sphinx-action/issues/16
pre-build-command: "sudo apt-get update -y && sudo apt-get install -y git && pip install . && pip install -r docs/requirements.txt"
pre-build-command: "sudo apt-get update -y && sudo apt-get install -y git && pip install -r docs/requirements.txt"
build-command: "sphinx-build -b html source build"
docs-folder: "docs/"
- name: Test Documentation
env:
SPHINX_MOCK_REQUIREMENTS: 0
run: |
# First run the same pipeline as Read-The-Docs
sudo apt-get install python3-sphinx
sudo apt-get install -y texlive-latex-extra dvipng texlive-pictures
sudo apt-get install -y cmake
pip install .
pip install -r docs/requirements.txt
cd docs
make clean
make html
shell: bash
- uses: actions/upload-artifact@master
with:
name: Documentation
path: docs/build/
34 changes: 26 additions & 8 deletions .github/workflows/sphinx-docs-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy mkdocs
name: Deploy Sphinx Docs

on:
push:
Expand All @@ -9,10 +9,28 @@ jobs:
sphinx-check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: ammaraskar/sphinx-action@master
with:
# git is required to clone the docs theme
# before custom requirement are resolved https://github.com/ammaraskar/sphinx-action/issues/16
pre-build-command: "apt-get update -y && apt-get install -y git && pip install -r docs/requirements.txt"
docs-folder: "docs/"
- uses: actions/checkout@master
- uses: ammaraskar/sphinx-action@master
with:
# git is required to clone the docs theme
# before custom requirement are resolved https://github.com/ammaraskar/sphinx-action/issues/16
pre-build-command: "sudo apt-get update -y && sudo apt-get install -y git && pip install -r docs/requirements.txt"
build-command: "sphinx-build -b html source build"
docs-folder: "docs/"
- name: Deploy Documentation
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: master
force: true
# run: |
# # First run the same pipeline as Read-The-Docs
# sudo apt-get install python3-sphinx
# sudo apt-get install -y texlive-latex-extra dvipng texlive-pictures
# sudo apt-get install -y cmake
# pip install .
# pip install -r docs/requirements.txt
# cd docs
# make html
# shell: bash
# - name:
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Files
*.DS_Store
*.vscode
*.idea
*.vs
.vscode
# dotenv
Expand Down
4 changes: 1 addition & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
contain the root `toctree` directive.
Quickvision API
=======================================
===============

.. toctree::
:maxdepth: 2
:caption: Contents:

modules

Indices and tables
==================

Expand Down
File renamed without changes.
7 changes: 0 additions & 7 deletions docs/source/setup.rst

This file was deleted.

1 change: 0 additions & 1 deletion quickvision/models/classification/cnn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
sanity_fit,
)
from quickvision.models.classification.cnn.model_factory import (
create_timm_cnn,
vision_cnn,
create_vision_cnn,
)
Expand Down
20 changes: 1 addition & 19 deletions quickvision/models/classification/cnn/model_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,11 @@
# We will remove the Linear Layer and create a new Linear Layer with num_classes
# Port from pytorch_cnn_trainer https://github.com/oke-aditya/pytorch_cnn_trainer

import timm
import torchvision
from quickvision.models import components
import torch.nn as nn

__all__ = ["create_timm_cnn", "vision_cnn", "create_vision_cnn"]


def create_timm_cnn(model_name: str, num_classes: int,
in_channels: int = 3, pretrained: bool = True,):

"""
Creates a model from PyTorch Image Models repository.
To know which models are supported print(timm.list_models())
Args:
model_name (str) : Name of the model. E.g. efficientnet_b3
num_classes (int) : Number of classes for classification.
in_channels (int) : Defualt 3. Number of channels of images, 1 for grayscale, 3 for RGB
pretrained (bool) : If true uses modelwweights pretrained on ImageNet.
"""
model = timm.create_model(model_name, pretrained=pretrained, num_classes=num_classes,
in_chans=in_channels,)
return model
__all__ = ["vision_cnn", "create_vision_cnn"]


class vision_cnn(nn.Module):
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
timm
pytorch_lightning
scipy
5 changes: 0 additions & 5 deletions tests/test_cnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@


class ModelFactoryTester(unittest.TestCase):
def test_create_timm_cnn(self):
for model_name in supported_timm_models:
model = cnn.create_timm_cnn(model_name, 10, pretrained=None)
self.assertTrue(isinstance(model, nn.Module))

def test_vision_cnn(self):
for model_name in supported_tv_models:
model = cnn.vision_cnn(model_name, 10, pretrained=None)
Expand Down

0 comments on commit e7b075e

Please sign in to comment.