Skip to content

Commit b0e8f80

Browse files
shakibamrdShakiba Moradian
andauthored
add GitHub Pages (#245)
* docs(Experiment): add docstrings to Experiment * docs(docs/): add sphinx docs folders * docs(profiles.py): add docstrings to classes * docs(BaseProfile): add missing docstrings * build(pyproject.toml): add sphinx dependecies * docs(docs/source): fix landing pages of sphinx docs * build(pyproject.toml): add missing gdown dependency * docs(index.rst): update landing page of ConfigurableOptimizer * docs(docs/README.md): create seperate README.md to docs * docs(docs/source): add benchsuite documentation to first page * docs(conf.py): remove none existing _static folder * docs(BaseProfile): remove unexpected indentation in configure_regularization docs * build(jekyll-gh-pages.yml): add workflow to build docs when pushing on main * docs(BaseProfile): fix configure_regularization indentation * docs(README.md): reformat demo notebook for ConfigurableOptimizer * docs(SNASProfile): remove example in configure_sample() * docs(pyproject.toml): move doc dependencies form primary set to doc set * docs(BaseProfile): fix docstring for better readability * docs(BaseProfile): add missing dash for projection-based * docs(BaseProfile): update docstring for readability * docs(BaseProfile): fix typo in adversarial * docs(BaseProfile): add dropout range to docstring * docs(BaseProfile): improve function description _set_partial_connector() * docs(BaseProfile): improve _set functions docstrings * docs(BaseProfile): improve get_config docstring * docs(BaseProfile): improve _initialize_sampler_config's docstring * docs(BaseProfile): add description of default config for PC * docs(confopt): change 'Whether to' to 'Flag to' in docstrings * docs(BaseProfile): add parentheses for better readability * docs(BaseProfile): update configure_trainer docstring for readability * docs(BaseProfile): add all params of trainer_config to docstring * docs(BaseProfile): update experiment's docstring * docs(Experiment): fix spelling in docstring * docs(Experiment): update train_supernet docstring for readability * docs(Experiment): remove vauge description of use_benchmark * build(benchsuite_doc.md): move benchsuite_doc.md from scripts to source * build(jekyll-gh-pages.yml): add installation of confopt to workflow * docs(conf.py): add recognized source files type * docs(PerturbationArchSelectionSupport): fix typo in docstring --------- Co-authored-by: Shakiba Moradian <moradias@informatik.uni-freiburg.de>
1 parent f4c6143 commit b0e8f80

32 files changed

+1399
-36
lines changed

.github/workflows/jekyll-gh-pages.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build and Deploy Documentation
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Python
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: '3.9'
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install sphinx myst-parser sphinx_rtd_theme sphinx-panels
33+
34+
- name: Install your package
35+
run: |
36+
pip install -e ".[dev, test]"
37+
38+
- name: Build Sphinx Documentation
39+
run: |
40+
cd docs
41+
make clean
42+
make html
43+
44+
- name: Build and Deploy with Jekyll
45+
uses: peaceiris/actions-gh-pages@v4
46+
with:
47+
github_token: ${{ secrets.GITHUB_TOKEN }}
48+
publish_dir: ./docs/build/html/

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) -v $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/source/README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Configurable Optimizer
2+
3+
[![confopt](https://i.postimg.cc/xCsTZyrM/diagram-20250403.png)](https://postimg.cc/7G2kGzZZ)
4+
5+
Break down one-shot optimizers into their core ideas, modularize them, and then search the space of optimizers for the best one.
6+
7+
## Installation and Development
8+
First, install the dependencies required for development and testing in your environment. You can skip running the last line as it might take long.
9+
10+
```
11+
conda create -n confopt python=3.9
12+
conda activate confopt
13+
pip install -e ".[dev, test]"
14+
pip install -e ".[benchmark]"
15+
```
16+
17+
Install the precommit hooks
18+
```
19+
pre-commit install
20+
```
21+
22+
Run the tests
23+
```
24+
pytest tests
25+
```
26+
27+
Run with the slow benchmark tests
28+
```
29+
pytest --benchmark tests
30+
```
31+
32+
Try running an example
33+
```
34+
python examples/demo_light.py
35+
```
36+
37+
This project uses `mypy` for type checking, `ruff` for linting, and `black` for formatting. VSCode extensions can be found for each of these tools. The pre-commit hooks check for `mypy`/`ruff`/`black` errors and won't let you commit until you fix the issues. The pre-commit hooks also checks for proper commit message format.
38+
39+
The easiest way to ensure that the commits are well formatted is to commit using `cz commit` instead of `git commit`.
40+
41+
## Getting Started
42+
43+
We define modular, differentiable NAS components within our library.
44+
45+
#### Explore the Demo Notebook
46+
47+
We recommend exploring the [demo-notebook](../../examples/notebooks/demo_notebook.ipynb) for a hands-on experience with the library.
48+
49+
#### Run Your First Experiment (Vanilla DARTS)
50+
Below is a snippet that demonstrates how we run a vanilla-DARTS experiment.
51+
52+
53+
```python
54+
from confopt.profile import DARTSProfile
55+
from confopt.train import Experiment
56+
from confopt.enums import SearchSpaceType, DatasetType
57+
58+
profile = DARTSProfile(
59+
searchspace_type=SearchSpaceType.DARTS,
60+
epochs=3
61+
)
62+
63+
experiment = Experiment(
64+
search_space=SearchSpaceType.DARTS,
65+
dataset=DatasetType.CIFAR10,
66+
)
67+
68+
experiment.train_supernet(profile)
69+
70+
```

docs/source/baseprofile.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
BaseProfile
2+
===========
3+
4+
.. autoclass:: confopt.profile.BaseProfile
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
8+
:private-members:

docs/source/benchsuite_doc.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Bench Suite Documentation
2+
=========================
3+
4+
.. include:: ./benchsuite_doc.md
5+
:parser: myst_parser.sphinx_

docs/source/conf.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# -- Project information -----------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8+
9+
import os
10+
import sys
11+
from typing import Any
12+
13+
sys.path.insert(0, os.path.abspath('../../src'))
14+
15+
project = 'ConfigurableOptimizer'
16+
copyright = '2025, Arjun Krishnakumar, Shakiba Moradian, Abhash Kumar Jha'
17+
author = 'Arjun Krishnakumar, Abhash Kumar Jha, Shakiba Moradian'
18+
19+
20+
# -- General configuration ---------------------------------------------------
21+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
22+
23+
extensions = []
24+
25+
templates_path = ['_templates']
26+
exclude_patterns: list[Any] = []
27+
28+
29+
30+
# -- Options for HTML output -------------------------------------------------
31+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
32+
33+
html_theme = 'sphinx_rtd_theme'
34+
html_theme_options = {
35+
'canonical_url': '',
36+
'analytics_id': 'UA-XXXXXXX-1', # Provided by Google in your dashboard
37+
'logo_only': False,
38+
# 'display_version': True,
39+
'prev_next_buttons_location': 'bottom',
40+
'style_external_links': True,
41+
'vcs_pageview_mode': '',
42+
# 'style_nav_header_background': 'white',
43+
# Toc options
44+
'collapse_navigation': True,
45+
'sticky_navigation': True,
46+
'navigation_depth': 4,
47+
'includehidden': True,
48+
'titles_only': False
49+
}
50+
# html_static_path = ['_static']
51+
52+
source_suffix = {
53+
'.rst': 'restructuredtext',
54+
'.md': 'markdown',
55+
}
56+
57+
extensions = [
58+
'sphinx.ext.napoleon',
59+
'sphinx.ext.autodoc',
60+
'myst_parser',
61+
]
62+
63+
napoleon_google_docstring = True
64+
napoleon_numpy_docstring = False # Disable if you're only using Google style
65+
66+
napoleon_use_param = True
67+
napoleon_use_ivar = True
68+
napoleon_include_private_with_doc = False
69+
napoleon_include_special_with_doc = False
70+
napoleon_use_rtype = False # Set to False so the return type is in the same line as the description

docs/source/dartsprofile.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
DARTS Profile
2+
=============
3+
4+
.. autoclass:: confopt.profile.DARTSProfile
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
8+
:exclude-members: SAMPLER_TYPE

docs/source/discreteprofile.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Discrete Profile
2+
================
3+
4+
.. autoclass:: confopt.profile.DiscreteProfile
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
8+
:private-members:
9+
:exclude-members: SAMPLER_TYPE

0 commit comments

Comments
 (0)