Skip to content

Commit

Permalink
Bring docs from OTX 1.6 to 2.0 (#3087)
Browse files Browse the repository at this point in the history
* Initial commit for documentation

* Fix typo

* Fix api tutorials

* Fix anomaly task part

* Fix typo train_config to train_subset

* Re-Rocate of api tutorial & write config file explain

* Fix wrong path in api_tutorial

* Change index to grid

* Fix tox build-docs

* Change tabs to tab-set
  • Loading branch information
harimkang authored Mar 13, 2024
1 parent bf6709a commit 6b55251
Show file tree
Hide file tree
Showing 81 changed files with 6,334 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

html:
@$(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(BUILDDIR)"/html $(SPHINXOPTS) $(O)

cp source/_static/redirects/guide-homepage-redirect.html "$(BUILDDIR)"/html/index.html

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

# Custom clean target that also removes autosummary generated files. Can
# be removed when https://github.com/sphinx-doc/sphinx/issues/1999 is fixed.
clean:
rm -rf "$(SOURCEDIR)/guide/reference/_autosummary"
$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21 changes: 21 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# OTX 2.0 Documentation

## Introduction

This is the source code for the OTX documentation. It is built using sphinx-design and myst parser.

## Installation

To install the dependencies, run the following command:

```bash
otx install --option docs
```

## Build

To build the documentation, run the following command:

```bash
sphinx-build -b html source build
```
44 changes: 44 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

if "%1" == "" goto help
if "%1" == "html" goto html

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:html
%SPHINXBUILD% -b %1 %SOURCEDIR% %BUILDDIR%\html %SPHINXOPTS% %O%

copy _static\redirects\guide-homepage-redirect.html %BUILDDIR%\html\index.html


:end
popd
77 changes: 77 additions & 0 deletions docs/source/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
:root {
/*****************************************************************************
* Theme config
**/
--pst-header-height: 45px;
/* smaller then heading font sizes*/
--pst-font-size-milli: 12px;
--pst-sidebar-font-size: 0.9em;
--pst-sidebar-caption-font-size: 0.9em;
/*****************************************************************************
* Color
*
* Colors are defined in rgb string way, "red, green, blue"
**/
--pst-color-success: 40, 167, 69;
--pst-color-info: 0, 123, 255;
/*23, 162, 184;*/
--pst-color-danger: 220, 53, 69;
--pst-color-headerlink: 198, 15, 15;
--pst-color-headerlink-hover: 255, 255, 255;
--pst-color-preformatted-text: 34, 34, 34;
--pst-color-preformatted-background: 250, 250, 250;
--pst-color-inline-code: 232, 62, 140;
--pst-color-active-navigation: 19, 6, 84;
--pst-color-navbar-link: 77, 77, 77;
--pst-color-navbar-link-hover: var(--pst-color-active-navigation);
--pst-color-navbar-link-active: var(--pst-color-active-navigation);
--pst-color-sidebar-link: 77, 77, 77;
--pst-color-sidebar-link-hover: var(--pst-color-active-navigation);
--pst-color-sidebar-link-active: var(--pst-color-active-navigation);
--pst-color-sidebar-expander-background-hover: 244, 244, 244;
--pst-color-sidebar-caption: 77, 77, 77;
--pst-color-toc-link: 119, 117, 122;
--pst-color-toc-link-hover: var(--pst-color-active-navigation);
--pst-color-toc-link-active: var(--pst-color-active-navigation);
/*****************************************************************************
* Icon
**/
/* font awesome icons*/
--pst-icon-check-circle: "\f058";
--pst-icon-info-circle: "\f05a";
--pst-icon-exclamation-triangle: "\f071";
--pst-icon-exclamation-circle: "\f06a";
--pst-icon-times-circle: "\f057";
--pst-icon-lightbulb: "\f0eb";
/*****************************************************************************
* Admonitions
**/
--pst-color-admonition-default: var(--pst-color-info);
--pst-color-admonition-note: var(--pst-color-info);
--pst-color-admonition-attention: var(--pst-color-warning);
--pst-color-admonition-caution: var(--pst-color-warning);
--pst-color-admonition-warning: var(--pst-color-warning);
--pst-color-admonition-danger: var(--pst-color-danger);
--pst-color-admonition-error: var(--pst-color-danger);
--pst-color-admonition-hint: var(--pst-color-success);
--pst-color-admonition-tip: var(--pst-color-success);
--pst-color-admonition-important: var(--pst-color-success);
--pst-icon-admonition-default: var(--pst-icon-info-circle);
--pst-icon-admonition-note: var(--pst-icon-info-circle);
--pst-icon-admonition-attention: var(--pst-icon-exclamation-circle);
--pst-icon-admonition-caution: var(--pst-icon-exclamation-triangle);
--pst-icon-admonition-warning: var(--pst-icon-exclamation-triangle);
--pst-icon-admonition-danger: var(--pst-icon-exclamation-triangle);
--pst-icon-admonition-error: var(--pst-icon-times-circle);
--pst-icon-admonition-hint: var(--pst-icon-lightbulb);
--pst-icon-admonition-tip: var(--pst-icon-lightbulb);
--pst-icon-admonition-important: var(--pst-icon-exclamation-circle);
}

.navbar {
background: #0095ca !important;
}

.video {
text-align: center;
}
Binary file added docs/source/_static/logos/github_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/logos/otx-logo-black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/logos/otx-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions docs/source/_static/redirects/guide-homepage-redirect.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<meta
http-equiv="refresh"
content="0; URL='guide/get_started/introduction.html'"
/>
114 changes: 114 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup -------------------------------------------------------------- #

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#

import os
import sys

sys.path.insert(0, os.path.abspath("../../src"))

from otx import __version__

# ruff: noqa

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

project = "OpenVINO™ Training Extensions"
copyright = "2024, OpenVINO™ Training Extensions Contributors"
author = "OpenVINO™ Training Extensions Contributors"
release = __version__

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

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.napoleon", # Support for NumPy and Google style docstrings
"sphinx.ext.autodoc",
"sphinx_copybutton",
"sphinx.ext.autosummary", # Create neat summary tables
"sphinx.ext.viewcode", # Find the source files
"sphinx.ext.autosectionlabel", # Refer sections its title
"sphinx.ext.intersphinx", # Generate links to the documentation
"sphinx_tabs.tabs",
"sphinx_design",
]

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

suppress_warnings = [
"ref.python",
"autosectionlabel.*",
]

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

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []

# -- Options for HTML output ------------------------------------------------- #
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
# 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_theme = "pydata_sphinx_theme"
html_static_path = ["_static"]

html_theme_options = {
"navbar_center": [],
"logo": {
"image_light": "logos/otx-logo.png",
"image_dark": "logos/otx-logo.png",
},
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/openvinotoolkit/training_extensions",
"icon": "_static/logos/github_icon.png",
"type": "local",
},
],
}
html_css_files = [
"css/custom.css",
]

# -- Extension configuration -------------------------------------------------
autodoc_docstring_signature = True
autodoc_member_order = "bysource"
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"numpy": ("https://numpy.org/doc/stable/", None),
}
autodoc_member_order = "groupwise"
autodoc_default_options = {
"members": True,
"methods": True,
"special-members": "__call__",
"exclude-members": "_abc_impl",
"show-inheritance": True,
}

autoclass_content = "both"

autosummary_generate = True # Turn on sphinx.ext.autosummary
autosummary_ignore_module_all = False # Summary list in __all__ no others
# autosummary_imported_members = True # document classes and functions imported in modules
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Adaptive Training
==================

Adaptive-training focuses to adjust the number of iterations or interval for the validation to achieve the fast training.
In the small data regime, we don't need to validate the model at every epoch since there are a few iterations at a single epoch.
To handle this, we have implemented module named ``AdaptiveTrainScheduling``. This callback controls the interval of the validation to do faster training.

.. note::
``AdaptiveTrainScheduling`` changes the interval of the validation, evaluation and updating learning rate by checking the number of dataset.


.. tab-set::

.. tab-item:: API

.. code-block:: python
from otx.algo.callbacks.adaptive_train_scheduling import AdaptiveTrainScheduling
engine.train(callbacks=[AdaptiveTrainScheduling()])
.. tab-item:: CLI

.. code-block:: shell
(otx) ...$ otx train ... --callbacks otx.algo.callbacks.adaptive_train_scheduling.AdaptiveTrainScheduling
Loading

0 comments on commit 6b55251

Please sign in to comment.