Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
DOC: Add scripts to RTD (#793)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhessey committed Sep 6, 2022
1 parent c7b2051 commit 879cb5f
Show file tree
Hide file tree
Showing 13 changed files with 114 additions and 55 deletions.
8 changes: 7 additions & 1 deletion InnerEye/Scripts/move_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# ------------------------------------------------------------------------------------------
from argparse import ArgumentParser
import argparse
from pathlib import Path
from typing import Tuple

Expand Down Expand Up @@ -99,7 +100,7 @@ def get_workspace(config: MoveModelConfig) -> Workspace:
resource_group=config.resource_group)


def main() -> None:
def get_move_model_parser() -> argparse.ArgumentParser:
parser = ArgumentParser()
parser.add_argument("-a", "--action", type=str, required=True,
help="Action (download or upload)")
Expand All @@ -114,6 +115,11 @@ def main() -> None:
parser.add_argument("-m", "--model_id", type=str, required=True,
help="The AzureML model ID")

return parser

def main() -> None:

parser = get_move_model_parser()
args = parser.parse_args()
config = MoveModelConfig(workspace_name=args.workspace_name, subscription_id=args.subscription_id,
resource_group=args.resource_group,
Expand Down
11 changes: 11 additions & 0 deletions InnerEye/Scripts/submit_for_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# ------------------------------------------------------------------------------------------

import argparse
import logging
import shutil
import sys
Expand Down Expand Up @@ -213,6 +214,16 @@ def submit_for_inference(args: SubmitForInferenceConfig, azure_config: AzureConf
return download_path


def get_submit_for_inference_parser() -> argparse.ArgumentParser:
"""This function is need to allow sphinx to access the arguments for documenation
:return: An example parser used for inference submission
"""

inference_config = SubmitForInferenceConfig(should_validate=False)
return inference_config.create_argparser()


def main(args: Optional[List[str]] = None, project_root: Optional[Path] = None) -> None:
"""
Main function.
Expand Down
39 changes: 21 additions & 18 deletions TestSubmodule/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ dependencies:
- lame=3.100=h7b6447c_0
- lcms2=2.12=h3be6417_0
- ld_impl_linux-64=2.38=h1181459_1
- lerc=3.0=h295c915_0
- libdeflate=1.8=h7f8727e_5
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
Expand All @@ -31,7 +33,7 @@ dependencies:
- libpng=1.6.37=hbc83047_0
- libstdcxx-ng=11.2.0=h1234567_1
- libtasn1=4.16.0=h27cfd23_0
- libtiff=4.2.0=h2818925_1
- libtiff=4.4.0=hecacb30_0
- libunistring=0.9.10=h27cfd23_0
- libuv=1.40.0=h7b6447c_0
- libvpx=1.7.0=h439df22_0
Expand All @@ -52,7 +54,7 @@ dependencies:
- pytorch=1.10.0=py3.8_cuda11.3_cudnn8.2.0_0
- pytorch-mutex=1.0=cuda
- readline=8.1.2=h7f8727e_1
- setuptools=61.2.0=py38h06a4308_0
- setuptools=63.4.1=py38h06a4308_0
- sqlite=3.39.2=h5082296_0
- tk=8.6.12=h1ccaba5_0
- torchvision=0.11.1=py38_cu113
Expand Down Expand Up @@ -111,17 +113,17 @@ dependencies:
- bleach==5.0.1
- cachetools==4.2.4
- cffi==1.15.1
- charset-normalizer==2.1.0
- charset-normalizer==2.1.1
- click==8.1.3
- cloudpickle==1.6.0
- colorama==0.4.5
- commonmark==0.9.1
- conda-merge==0.1.5
- contextlib2==21.6.0
- coverage==6.4.3
- coverage==6.4.4
- cryptography==3.3.2
- cycler==0.11.0
- databricks-cli==0.17.1
- databricks-cli==0.17.3
- dataclasses-json==0.5.2
- debugpy==1.6.3
- defusedxml==0.7.1
Expand All @@ -146,7 +148,7 @@ dependencies:
- google-auth==1.35.0
- google-auth-oauthlib==0.4.6
- gputil==1.4.0
- greenlet==1.1.2
- greenlet==1.1.3
- grpcio==1.47.0
- gunicorn==20.1.0
- h5py==2.10.0
Expand All @@ -163,21 +165,21 @@ dependencies:
- ipykernel==6.15.1
- ipython==7.31.1
- ipython-genutils==0.2.0
- ipywidgets==7.7.1
- ipywidgets==8.0.1
- isodate==0.6.1
- itsdangerous==2.1.2
- jeepney==0.8.0
- jinja2==3.0.2
- jmespath==0.10.0
- joblib==0.16.0
- jsonpickle==2.2.0
- jsonschema==4.9.1
- jsonschema==4.14.0
- jupyter==1.0.0
- jupyter-client==6.1.5
- jupyter-console==6.4.4
- jupyter-core==4.11.1
- jupyterlab-pygments==0.2.2
- jupyterlab-widgets==1.1.1
- jupyterlab-widgets==3.0.2
- kiwisolver==1.4.4
- lightning-bolts==0.4.0
- llvmlite==0.34.0
Expand All @@ -186,13 +188,13 @@ dependencies:
- markdown==3.4.1
- markdown-it-py==2.1.0
- markupsafe==2.1.1
- marshmallow==3.17.0
- marshmallow==3.17.1
- marshmallow-enum==1.5.1
- matplotlib==3.3.0
- mccabe==0.6.1
- mdit-py-plugins==0.3.0
- mdurl==0.1.2
- mistune==0.8.4
- mistune==2.0.4
- mlflow==1.23.1
- mlflow-skinny==1.28.0
- monai==0.6.0
Expand All @@ -205,12 +207,12 @@ dependencies:
- mypy==0.910
- mypy-extensions==0.4.3
- myst-parser==0.18.0
- nbclient==0.6.6
- nbconvert==6.5.3
- nbclient==0.6.7
- nbconvert==7.0.0
- nbformat==5.4.0
- ndg-httpsclient==0.5.1
- nest-asyncio==1.5.5
- networkx==2.8.5
- networkx==2.8.6
- nibabel==4.0.1
- notebook==6.4.12
- numba==0.51.2
Expand Down Expand Up @@ -259,7 +261,7 @@ dependencies:
- pywavelets==1.3.0
- pyyaml==6.0
- pyzmq==23.2.1
- qtconsole==5.3.1
- qtconsole==5.3.2
- qtpy==2.2.0
- querystring-parser==1.2.4
- requests==2.28.1
Expand All @@ -282,6 +284,7 @@ dependencies:
- snowballstemmer==2.2.0
- soupsieve==2.3.2.post1
- sphinx==5.0.2
- sphinx-argparse==0.3.1
- sphinx-basic-ng==0.0.1a12
- sphinx-rtd-theme==1.0.0
- sphinxcontrib-applehelp==1.0.2
Expand Down Expand Up @@ -310,13 +313,13 @@ dependencies:
- torchmetrics==0.6.0
- tornado==6.2
- tqdm==4.64.0
- typing-inspect==0.7.1
- typing-inspect==0.8.0
- umap-learn==0.5.2
- urllib3==1.26.7
- webencodings==0.5.1
- websocket-client==1.3.3
- websocket-client==1.4.0
- werkzeug==2.2.2
- widgetsnbextension==3.6.1
- widgetsnbextension==4.0.2
- wrapt==1.14.1
- yacs==0.1.8
- yarl==1.8.1
Expand Down
35 changes: 18 additions & 17 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,30 @@

# -- Project information -----------------------------------------------------

project = 'InnerEye-DeepLearning'
copyright = 'Microsoft Corporation'
author = 'Microsoft'
project = "InnerEye-DeepLearning"
copyright = "Microsoft Corporation"
author = "Microsoft"

# The full version, including alpha/beta/rc tags
release = '0.4'
release = "0.4"


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# extensions coming with Sphinx (named "sphinx.ext.*") or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx_rtd_theme',
'myst_parser',
'sphinx.ext.viewcode',
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx_rtd_theme",
"myst_parser",
"sphinx.ext.viewcode",
"sphinxarg.ext",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand All @@ -61,23 +62,23 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'furo'
html_theme = "furo"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ['_static']
# html_static_path = ["_static"]

source_suffix = {
'.rst': 'restructuredtext',
'.md': 'markdown',
".rst": "restructuredtext",
".md": "markdown",
}

# Autodoc options

autodoc_default_options = {
'members': True,
'undoc-members': True,
"members": True,
"undoc-members": True,
}


Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ InnerEye-DeepLearning Documentation
md/CHANGELOG.md

.. toctree::
:caption: API documentation (🚧 Work In Progress 🚧)
:caption: API documentation
:maxdepth: 2

rst/api/index
Expand Down
Empty file.
6 changes: 6 additions & 0 deletions docs/source/rst/api/Scripts/move_model.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Move model
===========

.. argparse::
:ref: InnerEye.Scripts.move_model.get_move_model_parser
:prog: move_model.py
8 changes: 8 additions & 0 deletions docs/source/rst/api/Scripts/runner.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Runner
======

This script is the entry point for running all InnerEye jobs, both locally and in AzureML. See the user guides for example usage.

.. argparse::
:ref: InnerEye.Azure.azure_runner.create_runner_parser
:prog: runner.py
11 changes: 11 additions & 0 deletions docs/source/rst/api/Scripts/scripts.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Scripts
=======

Please see links below for details on the available arguments for each of the primary InnerEye scripts.

.. toctree::
:maxdepth: 1

runner
submit_for_inference
move_model
8 changes: 8 additions & 0 deletions docs/source/rst/api/Scripts/submit_for_inference.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Submit for Inference
====================

This script is used to submit a single image for inference against a trained model.

.. argparse::
:ref: InnerEye.Scripts.submit_for_inference.get_submit_for_inference_parser
:prog: submit_for_inference.py
1 change: 1 addition & 0 deletions docs/source/rst/api/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.. toctree::

ML/ML
Scripts/scripts

0 comments on commit 879cb5f

Please sign in to comment.