Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: pylint

on:
pull_request:
workflow_dispatch:

jobs:
checks:
runs-on: ubuntu-20.04
strategy:
max-parallel: 4
matrix:
python-version: [3.9, "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Check lint
run: tox -e py$(echo ${{ matrix.python-version }} | tr -d .)-lint
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: tests

on:
push:
branches: ["main", "develop"]
branches: ["main"]
pull_request:
branches: ["main", "develop"]

Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
set -xe
python -VV
python -c "import torch; print(torch.__version__)"
pytest --cov=orthogonium.layers.conv.AOC --cov-report lcov tests
pytest --cov=orthogonium.layers --cov-report lcov tests
shell: bash

- name: Upload Coverage to Coveralls
Expand Down
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ __pycache__
# IDE / Tools files
.vscode
.tox
env_flashlipschitz
env_d16_flashlipschitz
env_orthogonium
*wandb

# Files generated:
Expand All @@ -19,14 +18,11 @@ docs/build
# mkdocs documentation
/site

env_opacus/

# all pth files
*.pth

lightning_logs/
scripts/data/
scripts/test_gan/data/
output/
*.tar
*_args.txt
Expand All @@ -37,6 +33,5 @@ wandb/
*.ckpt
*.pth
scripts/data/
scripts/test_gan/data/
scripts/ortho_gan/data/
*.csv
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ Thanks for taking the time to contribute!

From opening a bug report to creating a pull request: every contribution is
appreciated and welcome. If you're planning to implement a new feature or change
the api please create an [issue first](https://https://github.com/deel-ai/dp-lipschitz/issues/new). This way we can ensure that your precious
the api please create an [issue first](https://https://github.com/thib-s/orthogonium/issues/new). This way we can ensure that your precious
work is not in vain.


## Setup with make

- Clone the repo `git clone https://github.com/deel-ai/dp-lipschitz.git`.
- Go to your freshly downloaded repo `cd lipdp`
- Clone the repo `git clone https://github.com/thib-s/orthogonium.git`.
- Go to your freshly downloaded repo `cd orthogonium`
- Create a virtual environment and install the necessary dependencies for development:

`make prepare-dev && source lipdp_dev_env/bin/activate`.
`make prepare-dev && source orthogonium_dev_env/bin/activate`.

Welcome to the team !

Expand Down Expand Up @@ -42,7 +42,7 @@ Basically, it will check that your code follow a certain number of convention. A

After getting some feedback, push to your fork and submit a pull request. We
may suggest some changes or improvements or alternatives, but for small changes
your pull request should be accepted quickly (see [Governance policy](https://github.com/deel-ai/lipdp/blob/master/GOVERNANCE.md)).
your pull request should be accepted quickly (see [Governance policy](https://github.com/thib-s/orthogonium/blob/master/GOVERNANCE.md)).

Something that will increase the chance that your pull request is accepted:

Expand Down
4 changes: 2 additions & 2 deletions GOVERNANCE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# GOVERNANCE

`lipdp` is developped as part of the Artificial and Natural Intelligence Toulouse Institute (DEEL/ANITI) program.
`orthogonium` is developped as part of the Artificial and Natural Intelligence Toulouse Institute (DEEL/ANITI) program.

DEEL/ANITI is this repository owner and the write rights manager.

Expand All @@ -10,7 +10,7 @@ These management rules are intended to be collaborative and all those involved i

### Governance committee

The governance committee is initially composed of DEEL members who contributed to the first version of `lipdp` and are the only contributors to the master branch.
The governance committee is initially composed of DEEL members who contributed to the first version of `orthogonium` and are the only contributors to the master branch.

The governance committee is responsible for the master branch that contains the code of the version of the library that is officially recognised.

Expand Down
26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@ help:

prepare-dev:
python3 -m pip install virtualenv
python3 -m venv env_flashlipschitz
. env_flashlipschitz/bin/activate && pip install --upgrade pip
. env_flashlipschitz/bin/activate && pip install -e .[dev]
. env_flashlipschitz/bin/activate && pre-commit install
. env_flashlipschitz/bin/activate && pre-commit install-hooks
. env_flashlipschitz/bin/activate && pre-commit install --hook-type commit-msg
python3 -m venv env_orthogonium
. env_orthogonium/bin/activate && pip install --upgrade pip
. env_orthogonium/bin/activate && pip install -e .[dev]
. env_orthogonium/bin/activate && pre-commit install
. env_orthogonium/bin/activate && pre-commit install-hooks
. env_orthogonium/bin/activate && pre-commit install --hook-type commit-msg

test:
. env_flashlipschitz/bin/activate && tox
. env_orthogonium/bin/activate && tox

check_all:
. env_flashlipschitz/bin/activate && pre-commit run --all-files
. env_orthogonium/bin/activate && pre-commit run --all-files

updatetools:
. env_flashlipschitz/bin/activate && pre-commit autoupdate
. env_orthogonium/bin/activate && pre-commit autoupdate

test-disable-gpu:
. env_flashlipschitz/bin/activate && CUDA_VISIBLE_DEVICES=-1 tox
. env_orthogonium/bin/activate && CUDA_VISIBLE_DEVICES=-1 tox

doc:
. env_flashlipschitz/bin/activate && mkdocs build
. env_flashlipschitz/bin/activate && mkdocs gh-deploy
. env_orthogonium/bin/activate && mkdocs build
. env_orthogonium/bin/activate && mkdocs gh-deploy

serve-doc:
. env_flashlipschitz/bin/activate && CUDA_VISIBLE_DEVICES=-1 mkdocs serve
. env_orthogonium/bin/activate && CUDA_VISIBLE_DEVICES=-1 mkdocs serve
39 changes: 21 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,22 @@

<div align="center">
<a href="#">
<img src="https://img.shields.io/badge/Python-3.9 ... 3.12-efefef">
<img src="https://img.shields.io/badge/Python-3.9+-efefef">
</a>
<a href="#">
<img src="https://img.shields.io/badge/Pytorch-2.0 ... 2.5-00008b">
<img src="https://img.shields.io/badge/Pytorch-2.0+-00008b">
</a>
<a href="https://github.com/TODO/orthogonium/actions/workflows/python-lints.yml">
<img alt="PyLint" src="https://github.com/TODO/orthogonium/actions/workflows/python-lints.yml/badge.svg">
<a href="https://github.com/thib-s/orthogonium/actions/workflows/linters.yml">
<img alt="PyLint" src="https://github.com/thib-s/orthogonium/actions/workflows/linters.yml/badge.svg">
</a>
<a href="https://github.com/TODO/orthogonium/actions/workflows/python-tests.yml">
<img alt="Tox" src="https://github.com/TODO/orthogonium/actions/workflows/python-tests.yml/badge.svg">
<a href='https://coveralls.io/github/thib-s/orthogonium?branch=main'>
<img src='https://coveralls.io/repos/github/thib-s/orthogonium/badge.svg?branch=main' alt='Coverage Status' />
</a>
<a href="https://github.com/TODO/orthogonium/actions/workflows/python-publish.yml">
<img alt="Pypi" src="https://github.com/TODO/orthogonium/actions/workflows/python-publish.yml/badge.svg">
<a href="https://github.com/thib-s/orthogonium/actions/workflows/tests.yml">
<img alt="Tests" src="https://github.com/thib-s/orthogonium/actions/workflows/tests.yml/badge.svg">
</a>
<a href="https://github.com/thib-s/orthogonium/actions/workflows/python-publish.yml">
<img alt="Pypi" src="https://github.com/thib-s/orthogonium/actions/workflows/python-publish.yml/badge.svg">
</a>
<a href="https://pepy.tech/project/orthogonium">
<img alt="Pepy" src="https://static.pepy.tech/badge/orthogonium">
Expand Down Expand Up @@ -115,20 +118,20 @@ pip install -e .

```python
from orthogonium.layers.conv.AOC import AdaptiveOrthoConv2d
from orthogonium.layers.linear.reparametrizers import DEFAULT_ORTHO_PARAMS
from orthogonium.reparametrizers import DEFAULT_ORTHO_PARAMS

# use OrthoConv2d with the same params as torch.nn.Conv2d

conv = AdaptiveOrthoConv2d(
kernel_size=kernel_size,
in_channels=256,
out_channels=256,
stride=2,
groups=16,
bias=True,
padding=(kernel_size // 2, kernel_size // 2),
padding_mode="circular",
ortho_params=DEFAULT_ORTHO_PARAMS
kernel_size=kernel_size,
in_channels=256,
out_channels=256,
stride=2,
groups=16,
bias=True,
padding=(kernel_size // 2, kernel_size // 2),
padding_mode="circular",
ortho_params=DEFAULT_ORTHO_PARAMS
)
```

Expand Down
52 changes: 52 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Contributing

Thanks for taking the time to contribute!

From opening a bug report to creating a pull request: every contribution is
appreciated and welcome. If you're planning to implement a new feature or change
the api please create an [issue first](https://github.com/thib-s/orthogonium/issues). This way we can ensure that your precious
work is not in vain.


## Setup with make

- Clone the repo `git clone git@github.com:thib-s/orthogonium.git`.
- Go to your freshly downloaded repo `cd orthogonium`
- Create a virtual environment and install the necessary dependencies for development:

`make prepare-dev && source orthogonium_dev_env/bin/activate`.

Welcome to the team !


## Tests

To run test `make test`
This command activate your virtual environment and launch the `tox` command.


`tox` on the otherhand will do the following:
- run pytest on the tests folder
- run pylint on the deel-datasets main files
> Note: It is possible that pylint throw false-positive errors. If the linting test failed please check first pylint output to point out the reasons.

Please, make sure you run all the tests at least once before opening a pull request.

A word toward [Pylint](https://pypi.org/project/pylint/) for those that don't know it:
> Pylint is a Python static code analysis tool which looks for programming errors, helps enforcing a coding standard, sniffs for code smells and offers simple refactoring suggestions.

Basically, it will check that your code follow a certain number of convention. Any Pull Request will go through a Github workflow ensuring that your code respect the Pylint conventions (most of them at least).

## Submitting Changes

After getting some feedback, push to your fork and submit a pull request. We
may suggest some changes or improvements or alternatives, but for small changes
your pull request should be accepted quickly (see [Governance policy](https://github.com/thib-s/orthogonium/blob/release-no-advertising/GOVERNANCE.md)).

Something that will increase the chance that your pull request is accepted:

- Write tests and ensure that the existing ones pass.
- If `make test` is succesful, you have fair chances to pass the CI workflows (linting and test)
- Follow the existing coding style and run `make check_all` to check all files format.
- Write a [good commit message](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) (we follow a lowercase convention).
- For a major fix/feature make sure your PR has an issue and if it doesn't, please create one. This would help discussion with the community, and polishing ideas in case of a new feature.
28 changes: 28 additions & 0 deletions docs/api/aoc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
The most scalable method to build orthogonal convolution. Allows control of kernel size,
stride, groups dilation and transposed convolutions.

The classes `AdaptiveOrthoConv2d` and `AdaptiveOrthoConv2d` are not classes,
but factory function to selecte bewteen 3 different parametrizations, as depicted
in the following figure:

<img src="/assets/flowchart_v4.png" alt="drawing" style="width:300px;"/>

::: orthogonium.layers.conv.AOC.ortho_conv
rendering:
show_root_toc_entry: True
selection:
inherited_members: True


::: orthogonium.layers.conv.AOC.fast_block_ortho_conv
rendering:
show_root_toc_entry: true
selection:
inherited_members: true

::: orthogonium.layers.conv.AOC.rko_conv
rendering:
show_root_toc_entry: true
selection:
inherited_members: true

13 changes: 13 additions & 0 deletions docs/api/conv.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
::: orthogonium.layers.conv.AOC.ortho_conv
rendering:
show_root_toc_entry: True
selection:
inherited_members: True



::: orthogonium.layers.conv.SLL.sll_layer
rendering:
show_root_toc_entry: True
selection:
inherited_members: True
5 changes: 5 additions & 0 deletions docs/api/linear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
::: orthogonium.layers.linear.ortho_linear
rendering:
show_root_toc_entry: True
selection:
inherited_members: True
5 changes: 5 additions & 0 deletions docs/api/reparametrizers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
::: orthogonium.reparametrizers
rendering:
show_root_toc_entry: True
selection:
inherited_members: True
Binary file added docs/assets/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/flowchart_v4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading