Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
75be7e3
hamiltonian pinn experiments
andrewklayk May 25, 2026
8e805f6
Merge pull request #7 from andrewklayk/ham-pinn
andrewklayk May 25, 2026
86477a0
Merge branch 'humancompatible:main' into main
andrewklayk May 25, 2026
b6a06d6
move h0 in camassa
andrewklayk May 26, 2026
13f1bb9
docs
andrewklayk May 26, 2026
9f50604
docs update
andrewklayk May 27, 2026
a28b8bc
skeleton for other tutorials
andrewklayk Jun 1, 2026
dd5bd7d
change dual_range in alm and ialm to allow negative dual values
andrewklayk Jun 2, 2026
708a369
further docs
andrewklayk Jun 2, 2026
5ecd9f6
move doc notebooks to myst
andrewklayk Jun 2, 2026
715af2d
alm: add and fix built-in inequality constraint handling; relax on st…
andrewklayk Jun 2, 2026
fa69883
alm and ialm ineq constraint handling
andrewklayk Jun 3, 2026
7206c06
fix bug with neg dual init
andrewklayk Jun 3, 2026
b19e021
merge
andrewklayk Jun 3, 2026
ce19362
doc update
andrewklayk Jun 3, 2026
38cead9
bug in ineq init when range none
andrewklayk Jun 3, 2026
3c43169
little updates to tests, structure, toml
andrewklayk Jun 3, 2026
188a2b3
docs update
andrewklayk Jun 3, 2026
80ae8e0
alm, pbm docstrings
andrewklayk Jun 3, 2026
83ac4df
add skeleton for nupi
andrewklayk Jun 3, 2026
ef05eb0
camassa update
andrewklayk Jun 4, 2026
961f223
add nupi algorithm
andrewklayk Jun 4, 2026
a0a1d99
update docstring for ialm
andrewklayk Jun 4, 2026
8e4b658
update init for nupi
andrewklayk Jun 4, 2026
f02ab88
fix ialm doc
andrewklayk Jun 4, 2026
659170e
Add Read the Docs badge to README
andrewklayk Jun 8, 2026
37cdeb5
Fix badge formatting in README.md
andrewklayk Jun 8, 2026
9ee4e57
Fix docs badge formatting
andrewklayk Jun 8, 2026
2a59eb0
Update documentation badge in README.md
andrewklayk Jun 8, 2026
00c6b09
slight docs updates
andrewklayk Jun 8, 2026
b3cc1ab
docs update
andrewklayk Jun 11, 2026
dc00fa9
initial ddp support
andrewklayk Jun 11, 2026
b54b13d
update tests
andrewklayk Jun 11, 2026
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
27 changes: 27 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@


# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version, and other tools you might need
build:
os: ubuntu-24.04
tools:
python: "3.13"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/source/conf.py

# Optionally, but recommended,
# declare the Python requirements required to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
- requirements: requirements.txt


4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# humancompatible-train: a package for constrained machine learning

[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Setup](https://github.com/humancompatible/train/actions/workflows/setup.yml/badge.svg)](https://github.com/humancompatible/train/actions/workflows/setup.yml)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Setup](https://github.com/humancompatible/train/actions/workflows/setup.yml/badge.svg)](https://github.com/humancompatible/train/actions/workflows/setup.yml) [![docs](https://app.readthedocs.org/projects/humancompatible-train/badge/?version=latest)](https://humancompatible-train.readthedocs.io/en/latest/?badge=latest)

The toolkit implements algorithms for constrained training of neural networks based on PyTorch, and inspired by PyTorch's API.
<!-- , as well as a tool to compare stochastic-constrained stochastic optimization algorithms on a _fair learning_ task in the `experiments` folder. -->
Expand Down Expand Up @@ -29,7 +29,7 @@ The only dependencies of this package are `numpy` and `torch`.

## Using the toolkit

The toolkit implements algorithms for constrained training of neural networks based on PyTorch.
The toolkit implements algorithms for constrained training of neural networks based on PyTorch. For the documentation, please visit [our Read the Docs page!](https://humancompatible-train.readthedocs.io?version=latest)

The algorithms are intended for use in tandem with classic PyTorch optimizers, calculating the Lagrangian and keeping track of the dual variables.

Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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

# 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)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

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

%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%

:end
popd
5 changes: 5 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sphinx
myst-nb
.
furo
sphinx_rtd_theme
8 changes: 8 additions & 0 deletions docs/source/api_reference/dual_optimizers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Dual Optimizers
===============

.. toctree::
:titlesonly:
:glob:

dual_opts/*
6 changes: 6 additions & 0 deletions docs/source/api_reference/dual_opts/alm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ALM
=================


.. autoclass:: humancompatible.train.dual_optim.ALM
:members:
6 changes: 6 additions & 0 deletions docs/source/api_reference/dual_opts/ialm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
iALM
=================


.. autoclass:: humancompatible.train.dual_optim.iALM
:members:
6 changes: 6 additions & 0 deletions docs/source/api_reference/dual_opts/pbm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PBM
=================


.. autoclass:: humancompatible.train.dual_optim.PBM
:members:
8 changes: 8 additions & 0 deletions docs/source/api_reference/utils.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Utils
=====

.. toctree::
:titlesonly:
:glob:

utils/*
6 changes: 6 additions & 0 deletions docs/source/api_reference/utils/sampler.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
BalancedBatchSampler
====================


.. autoclass:: humancompatible.train.fairness.utils.BalancedBatchSampler
:members:
62 changes: 62 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

extensions = ["myst_nb", "sphinx.ext.autodoc"]


import os


project = 'humancompatible-train'
copyright = '2026, Andrii Kliachkin, Gilles Bareillies, Jana Lepsova, Jakub Marecek'
author = 'Andrii Kliachkin, Gilles Bareillies, Jana Lepsova, Jakub Marecek'
# release = '0.3.1'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration


templates_path = ['_templates']
exclude_patterns = []

nb_toctree = False
nb_number_headings = False
nb_execution_show_tb = False
nb_execution_mode = "cache"
nb_execution_timeout = 180

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

# html_theme = 'furo'
html_theme = 'sphinx_rtd_theme'

html_static_path = ['_static']

html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "/")

myst_enable_extensions = [
"amsmath",
"colon_fence",
"deflist",
"dollarmath",
"html_image",
]
myst_url_schemes = ("http", "https", "mailto")

source_suffix = {
".rst": "restructuredtext",
".md": "myst-nb",
".ipynb": "myst-nb",
}

nb_execution_mode = "cache"

import sys

sys.path.insert(0, os.path.abspath('./../..'))
Loading
Loading