Skip to content

Commit

Permalink
Add docs with auto API reference generation when pushed to main. (#109)
Browse files Browse the repository at this point in the history
* Add initial mkdocs

* Add mkdocs CI

* Update CI

* Change lighter color scheme

* Set md-nav to correct color in slate

* Update docs [WIP]

* Update projects

* Add docs publishing workflow

* Make docs-publish triggered by pushes on `main'

* Fix typo in docs (MyXRayDataset)

* Add info on docs contributions

* Add auto API reference generation

* Add list of submodules and py to each module, move version and logging

* Update README

* Update README

* Update lighter/utils/dynamic_imports.py

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update lighter/utils/runner.py

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update docs/overrides/components/navigation-links3.css

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update docstrings and reference generation

* Fix module type hint

---------

Co-authored-by: Suraj Pai <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 26, 2024
1 parent 8b5e7ed commit 2e8a27d
Show file tree
Hide file tree
Showing 64 changed files with 3,629 additions and 110 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/docs-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Docs Publish
on:
push:
branches:
- main
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material mkdocs-autorefs mkdocstrings
- run: mkdocs gh-deploy --force
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,5 @@ projects/*
!projects/README.md
!projects/cifar10
**/predictions/
*/.DS_Store
.DS_Store
40 changes: 39 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
# How to contribute
1. [Code contribution](#code-contribution)
- [Dependencies](#dependencies)
- [Codestyle](#codestyle)
- [Checks](#checks)
- [Before submitting](#before-submitting)
- [Other help](#other-help)

2. [Documentation contribution](#documentation-contribution)
- [Dependencies](#dependencies-1)
- [Serving the documentation locally](#serving-the-documentation-locally)
- [Deploying the documentation to GitHub Pages](#deploying-the-documentation-to-github-pages)


# Code contribution

## Dependencies

Expand Down Expand Up @@ -45,3 +58,28 @@ You can contribute by spreading a word about this library.
It would also be a huge contribution to write
a short article on how you are using this project.
You can also share your best practices with us.


# Documentation contribution
Our documentation is located in the `docs/` folder and is built using `mkdocs` and `mkdocs-material`.

The API reference is generated automatically from the docstrings in the code using `mkdocstrings`. Our docstrings follow the `google` style.

## Dependencies
To install `mkdocs-material` together with the required dependencies run:

```bash
pip install mkdocs-material mkdocs-autorefs mkdocstrings mkdocs-gen-files mkdocs-literate-nav mkdocs-section-index
```

## Serving the documentation locally
While working on the documentation, you can serve it locally to see the changes in real-time.

```bash
cd docs/
mkdocs serve
```

## Deploying the documentation to GitHub Pages

The documentation is automatically deployed once the changes are merged into the `main` branch.
37 changes: 26 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<div align="center">
<picture>
<!-- old code that allows different pics for light/dark mode -->
<!--
<source media="(prefers-color-scheme: dark)" srcset="./assets/images/lighter_dark.png">
<source media="(prefers-color-scheme: light)" srcset="./assets/images/lighter_light.png">
<img align="center" alt="Lighter logo" src="h/assets/images/lighter_dark.png">
-->
<img align="center" alt="Lighter logo" src="./assets/images/lighter.png">
</picture>
</div>
<br/>
Expand All @@ -12,35 +15,47 @@
</div>


Welcome to `lighter`, an elegant and powerful wrapper for [PyTorch Lightning](https://github.com/Lightning-AI/lightning) that simplifies the way you build and manage your deep learning experiments. Unleash your model's potential through a unified, **configuration-based** approach that streamlines the experimentation process, empowering both beginners and experts in the field.
With `lighter`, focus on your deep learning experiments and forget about boilerplate through:
1. **Task-agnostic** training logic already implemented for you (classification, segmentation, self-supervised, etc.)
2. **Configuration-based** approach that will ensure that you can always reproduce your experiments and know what hyperparameters you used.
3. Extremely **simple integration of custom** models, datasets, transforms, or any other components to your experiments.

&nbsp;

`lighter` stands on the shoulder of these two giants:
- [MONAI Bundle](https://docs.monai.io/en/stable/bundle_intro.html) - Configuration system. Similar to [Hydra](https://github.com/facebookresearch/hydra), but with additional features.
- [PyTorch Lightning](https://github.com/Lightning-AI/lightning) - Our [`LighterSystem`](https://project-lighter.github.io/lighter/reference/system/) is based on the PyTorch Lightning [`LightningModule`](https://lightning.ai/docs/pytorch/stable/common/lightning_module.html) and implements all the necessary training logic for you. Couple it with the PyTorch Lightning [Trainer](https://lightning.ai/docs/pytorch/stable/common/trainer.html) and you're good to go.

Simply put, `lighter = config(trainer + system)` 😇


## 📖 Usage

- [Documentation](https://project-lighter.github.io/lighter/)
- [📚 Documentation](https://project-lighter.github.io/lighter/)
- [🎥 YouTube Channel](https://www.youtube.com/channel/UCef1oTpv2QEBrD2pZtrdk1Q)

## 🚀 Install

Current release:
````
```bash
pip install project-lighter
````
```

Pre-release (up-to-date with the main branch):
````
```bash
pip install project-lighter --pre
````
```

For development:
````
```bash
make setup
make install # Install lighter via Poetry
make pre-commit-install # Set up the pre-commit hook for code formatting
poetry shell # Once installed, activate the poetry shell
````
```

## 💡 Projects
List of projects that use `lighter`:
Projects that use `lighter`:

| Project | Description |
| --- | --- |
Expand All @@ -49,7 +64,7 @@ List of projects that use `lighter`:

## 📄 Cite:

If you find `lighter` useful in your research or project, please consider citing it. Here's an example BibTeX citation entry:
If you find `lighter` useful in your research or project, please consider citing it:

```bibtex
@software{lighter,
Expand Down
Binary file added assets/images/lighter.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 removed assets/images/lighter_dark.png
Binary file not shown.
Binary file removed assets/images/lighter_light.png
Binary file not shown.
1 change: 1 addition & 0 deletions docs/advanced/callbacks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
🚧 Under construction 🚧
1 change: 1 addition & 0 deletions docs/advanced/inferer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
🚧 Under construction 🚧
1 change: 1 addition & 0 deletions docs/advanced/postprocessing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
🚧 Under construction 🚧
29 changes: 29 additions & 0 deletions docs/assets/extra.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[data-md-color-scheme="default"] {
--md-primary-fg-color: #459AA3;
--md-accent-fg-color: #459AA3;
color: #14181e;
}

[data-md-color-scheme="slate"] {
--md-primary-fg-color: #459AA3;
--md-accent-fg-color: #459AA3;
--md-default-bg-color: #14181e;
}
[data-md-color-scheme="slate"] .md-nav {
--md-typeset-a-color: #459AA3;
}

@media only screen and (min-width: 75.25em) {
.md-main__inner {
max-width: 1000em;
}
.md-sidebar--primary {
left: 0;
}
.md-sidebar--secondary {
right: 0;
margin-left: 0em;
-webkit-transform: none;
transform: none;
}
}
Binary file added docs/assets/images/Lighter_demo.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/assets/images/PL_demo.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/assets/images/lighter_banner.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/assets/images/lighter_favicon.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/assets/images/lighter_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 2e8a27d

Please sign in to comment.