Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
42a53f1
add DecoupledStraightThroughGumbelSoftmax
minashkinvladislav Oct 6, 2025
d78db3d
add visualizations for DSTGS
minashkinvladislav Oct 22, 2025
49cc436
meshkovvl:add rl benchmarks
VseMeshkov Oct 30, 2025
f1977dd
add rl algorithms
VseMeshkov Nov 2, 2025
dbe9035
Add files via upload
ILIAHHne63 Nov 3, 2025
8f9558f
Update __init__.py
ILIAHHne63 Nov 3, 2025
97d9b52
Update GeneralizedGumbelSoftmax.py
ILIAHHne63 Nov 9, 2025
06a39b3
Update __init__.py
ILIAHHne63 Nov 9, 2025
b0ebfae
Add files via upload
ILIAHHne63 Nov 9, 2025
9161e3d
Update __init__.py
ILIAHHne63 Nov 9, 2025
2774723
add 2 rl benchmarks in jupyter
VseMeshkov Nov 9, 2025
ce35250
Merge branch 'dev' of github.com:intsystems/relaxit into dev
VseMeshkov Nov 9, 2025
46a1a19
add bench
VseMeshkov Nov 9, 2025
c71b780
Add files via upload
ILIAHHne63 Nov 23, 2025
948641c
Update vae_generalized_gumbel_softmax.py
ILIAHHne63 Nov 23, 2025
ba59e1e
Add files via upload
ILIAHHne63 Nov 30, 2025
aefce42
Delete demo/vae_generalized_gumbel_softmax.py
ILIAHHne63 Nov 30, 2025
9aaca43
Update README.md
ILIAHHne63 Nov 30, 2025
7ebbf0d
documentation generalized gumbel softmax
ILIAHHne63 Dec 3, 2025
2552507
Update README.md
ILIAHHne63 Dec 3, 2025
27af942
Merge branch 'main' of github.com:intsystems/relaxit into dev
VseMeshkov Dec 18, 2025
4c3758e
add relax to lib
VseMeshkov Dec 18, 2025
2192077
Merge pull request #9 from intsystems/meshkovvl
VseMeshkov Dec 18, 2025
6917e3f
add uv initial uv support
minashkinvladislav Dec 21, 2025
1167820
fix tensor device handling in vae demo for DSTGS
minashkinvladislav Dec 21, 2025
99882d3
update gym to gymnasium
minashkinvladislav Dec 21, 2025
2c636e8
update uv.lock and pyproject.toml
minashkinvladislav Dec 21, 2025
b769517
update READMEs
minashkinvladislav Dec 21, 2025
de88bc5
update requirements.txt
minashkinvladislav Dec 21, 2025
e0d2956
update relaxit.css to fit more info
minashkinvladislav Dec 21, 2025
3c81e13
Merge pull request #10 from intsystems/v_min
ILIAHHne63 Dec 27, 2025
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
43 changes: 34 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,48 @@ In this project we implement different alternatives to it.
- [x] [Decoupled Straight-Through Gumbel-Softmax](https://github.com/intsystems/relaxit/blob/main/src/relaxit/distributions/DecoupledStraightThroughGumbelSoftmax.py), also see [📝 paper](https://arxiv.org/abs/2410.13331)
- [x] [RELAX](https://github.com/intsystems/relaxit/blob/main/rl_benchmarks/algorithms/relax.py), also see [📝 paper](https://arxiv.org/abs/2110.11960)

## 🛠️ Install
## 🛠️ Install Using `uv` (Recommended)

### Install via pip
### For Production
```bash
pip install relaxit
uv pip install relaxit
```

### Install from source
### For Development
```bash
pip install git+https://github.com/intsystems/relaxit
git clone https://github.com/intsystems/relaxit
cd relaxit
uv venv # create venv
source .venv/bin/activate # activate venv
uv sync # install all the dependencies
uv pip install -e . # make the relaxit package editable
```

### Install via Git clone
To run tests:
```bash
git clone https://github.com/intsystems/relaxit
cd relaxit
pip install -e .
uv run pytest tests/
```

To run Python scripts:
```bash
uv run python demo/vae_hard_concrete.py
```

To run notebooks:
```bash
uv run jupyter lab
```

## ⚒️ Install Using `pip`

### For Production
```bash
pip install -r requirements.txt
```

### For Development
```bash
pip install -r requirements-dev.txt
```

## 🚀 Quickstart
Expand Down
43 changes: 14 additions & 29 deletions demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,46 @@ This repository contains our demo code for various experiments. The main demo co

## Installation <a name="installation"></a>

To use this demo code, you need to have Python and the required packages installed on your computer.
To use this demo code, check out README in the root directory of this repository for installation instructions.

```bash
# Clone the repository:
git clone https://github.com/intsystems/relaxit.git

# Navigate to the repository directory:
cd relaxit/demo

# Create Virtual Environment with Conda:
conda create --name relaxit-demo python=3.10

# Activate the conda environment:
conda activate relaxit-demo

# Install Dependencies
pip install -r requirements.txt
```
## Additional experiments<a name="experiments"></a>

For additional demo experiments, we have implemented Variational Autoencoders (VAEs) with different latent discrete distributions from **Just Relax It**. These implementations are adapted from the [PyTorch](https://github.com/pytorch/examples/tree/main/vae) examples repository.
1. **Train and save the models:**
To run the additional demo code with VAEs, you need to train all the models and save their results. Execute the following commands:
```bash
# VAE with Correlated Bernoulli latent space
python vae_correlated_bernoulli.py
uv run python vae_correlated_bernoulli.py

# VAE with Gaussian Bernoulli latent space
python vae_gaussian_bernoulli.py
uv run python vae_gaussian_bernoulli.py

# VAE with Gumbel-Softmax top-K latent space
python vae_gumbel_softmax_topk.py
uv run python vae_gumbel_softmax_topk.py

# VAE with Hard Concrete latent space
python vae_hard_concrete.py
uv run python vae_hard_concrete.py

# VAE with Invertible Gaussian latent space
python vae_invertible_gaussian.py
uv run python vae_invertible_gaussian.py

# VAE with Stochastic Times Smooth latent space
python vae_stochastic_times_smooth.py
uv run python vae_stochastic_times_smooth.py

# VAE with Straight Through Bernoullii latent space
python vae_straight_through_bernoulli.py
uv run python vae_straight_through_bernoulli.py

# VAE with Rebar Relaxation Bernoullii latent space
python vae_rebar_relaxation.py
uv run python vae_rebar_relaxation.py

# VAE with Poisson latent space
python vae_generalized_gumbel_poisson.py
uv run python vae_generalized_gumbel_poisson.py

# VAE with Geometric latent space
python vae_generalized_gumbel_geometric.py
uv run python vae_generalized_gumbel_geometric.py

# VAE with Decoupled Straigt-Through Gumbel Softmax latent space
uv run python vae_decoupled_straight_through_gumbel_softmax.py.py
```
2. **View the results:**
After completing the training and testing of all the models, you can find the results of sampling and reconstruction methods in the directory `results`.
Expand All @@ -67,5 +54,3 @@ Moreover, we conducted experiments with Laplace Bridge between LogisticNormal an
These experiments aim to find the best parameters to make the distributions nearly identical on the simplex. The experiments can be found in the notebook `laplace-bridge.ipynb`.

Furthermore, the Reinforce algorithm is applied in the [Acrobot environment](https://www.gymlibrary.dev/environments/classic_control/acrobot/). Detailed experiments can be viewed in the notebook `reinforce.ipynb`. A script `reinforce.py` can also be used for training.


6 changes: 3 additions & 3 deletions demo/demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "nkiselev_relaxit",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -831,9 +831,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "undefined.undefined.undefined"
"version": "3.11.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
6 changes: 3 additions & 3 deletions demo/laplace-bridge.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "nkiselev_relaxit",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -175,9 +175,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.15"
"version": "3.11.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
19 changes: 14 additions & 5 deletions demo/quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,18 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"sample.shape: torch.Size([3, 4, 6])\n",
"sample.requires_grad: True\n"
]
}
],
"source": [
"import torch\n",
"from relaxit.distributions import InvertibleGaussian\n",
Expand All @@ -33,7 +42,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "nkiselev_relaxit",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -47,9 +56,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.15"
"version": "3.11.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
Loading
Loading