Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updat .pre-commit hook version #1795

Merged
merged 4 commits into from
May 13, 2024
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
14 changes: 10 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ repos:
hooks:
- id: ruff
name: ruff
entry: ruff
args: ["--fix", "--show-source"]
files: "numpyro/.*|tests/.*"
entry: ruff check
args: ["--fix", "--output-format=full"]
files: "(.py$)|(.*.ipynb$)"
language: system

- id: ruff-format
name: ruff-format
entry: ruff format
language: system
files: "(.py$)|(.*.ipynb$)"

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: debug-statements
- id: check-yaml
Expand Down
5 changes: 2 additions & 3 deletions examples/cvae-flax/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
## Conditional Variational Autoencoder in Flax

Trains a *Conditional Variational Autoencoder* (CVAE) on the MNIST data using Flax' neural network API.
Trains a *Conditional Variational Autoencoder* (CVAE) on the MNIST data using Flax' neural network API.

The model first trains a baseline to predict an entire MNIST image from a single quadrant of it (i.e., input is one quadrant of an image, output is the entire image (not the other three quadrants)).
Then, in a second model, the generation/prior/recognition nets of the CVAE are trained while keeping the model parameters of the baseline fixed/frozen.
We use Optax' `multi_transform` to apply different gradient transformations to the trainable parameters and the frozen parameters.

Running `main.py` trains the model(s) and plots a figure in the end comparing the baseline prediction with the CVAE prediction like this one:

![CVAE prediction](https://github.com/pyro-ppl/numpyro/tree/master/docs/source/_static/img/examples/cvae.png)

![CVAE prediction](https://github.com/pyro-ppl/numpyro/tree/master/docs/source/_static/img/examples/cvae.png)
Loading