This release is a pre-release and may not be stable for production use.
PhiJAX is a typed JAX framework for physics-informed neural networks (PINNs). It provides the
core tools for training PINNs: functional state, explicit-key sampling, reusable equations and objectives, adaptive
loss balancing, callbacks, logging, checkpointing, and prediction artifacts. Its Trainer and PhiModule lifecycles
are inspired by Lightning.
For a configuration-first project layout, start from
phijax-hydra-template and customize its entrypoints, Hydra
configs, and application DataModules.
Beta API: PhiJAX is under active development. Breaking changes may occur between major versions and during the beta period before the stable release. The supported public API is documented in package
__all__declarations. Checkpoints can be restored by compatible PhiJAX releases from the same major and minor version.
Quickstart | Guides | API reference | Changelog | Contributing
Why PhiJAX?
JAX provides automatic differentiation, vectorization, compilation, and accelerator support. PhiJAX adds the structure needed to build reproducible, maintainable PINN experiments:
- selective coordinate derivatives and reusable PDE, boundary, and data-fidelity equations;
- named objective terms with static, gradient-norm, and exact-NTK loss balancing;
- standard MLP, Modified MLP, and adaptive-residual PirateNet architectures with a custom NNX adapter;
- explicit model, optimizer, balancer, and PRNG state for reproducible compiled updates;
- familiar, Lightning-inspired lifecycles for trainers, modules, DataModules, callbacks, loggers, and checkpoints; and
- scientific data preparation on the CPU, automatic batch placement by the Trainer, and prediction files with a stable, versioned format.
PhiJAX reduces boilerplate for training, prediction, logging, and checkpointing without hiding JAX transformations or functional state. Hydra support is optional, and the core Trainer API does not depend on a configuration framework.
Installation
PhiJAX requires Python 3.12 or newer. Python 3.12, 3.13, and 3.14 are covered by CI.
pip install phijax
The default installation includes CPU-capable JAX. Select one mutually exclusive GPU extra when the matching NVIDIA runtime is available:
pip install "phijax[cuda12]"
# or
pip install "phijax[cuda13]"
Hydra configuration and MATLAB or HDF5 files use the hydra and io extras:
pip install "phijax[hydra,io]"
Optional experiment loggers are installed separately:
pip install "phijax[tensorboard]"
pip install "phijax[wandb]"
Extras can be combined. all installs every optional feature, without an accelerator:
pip install "phijax[all,cuda13]"
Replace cuda13 with cuda12 for a CUDA 12 environment; do not install both CUDA extras together.
Experimental TPU environments can use pip install "phijax[tpu]". The TPU, CUDA 12, and CUDA 13 extras are mutually
exclusive.
See the installation guide for environment verification and development setup.
Quickstart
The first runnable example solves a one-dimensional heat equation with initial, boundary, and PDE losses. It uses no external data and runs on CPU after JAX completes its initial compilation.
We recommend uv; install it by following the official installation guide. The example also works with pip alone in a standard Python virtual environment.
Clone the repository and run the example:
git clone https://github.com/HangJung97/PhiJAX.git
cd PhiJAX
# With uv (recommended)
uv sync
JAX_PLATFORMS=cpu uv run --no-sync python examples/quickstart.py
# Or with pip in a standard venv
python -m venv .venv
source .venv/bin/activate
python -m pip install .
JAX_PLATFORMS=cpu python examples/quickstart.py
JAX_PLATFORMS=cpu keeps the whole process strictly CPU-only. This is stronger than selecting
Trainer(accelerator="cpu"), which controls PhiJAX placement without changing JAX's process-wide default backend.
To run the same example on an available NVIDIA GPU:
uv sync --extra cuda13
uv run --no-sync python examples/quickstart.py --accelerator gpu
# Or with pip in the activated venv
python -m pip install ".[cuda13]"
python examples/quickstart.py --accelerator gpu
Replace cuda13 with cuda12 when using the CUDA 12 extra. If JAX reports a GPU allocation error, see the
troubleshooting guide.
Read the annotated quickstart for the equation, complete source, and an explanation of each runtime object.
Core workflow
PhiJAX keeps each part of a PINN workflow explicit while assembling the common training path for you:
Model factory + objective ---> PhiModule blueprint ----+
DataModule -------------------> named batches ---------+---> Trainer.fit() ---> FitResult ---> Trainer.predict()
Optimizer + seed --------------------------------------+
LossBalancer + update policy (optional) ---------------+
The Trainer initializes the model, splits independent PRNG streams, prepares data sources, compiles the update, moves
batches to devices, runs hooks, restores checkpoints, and cleans up resources. FitResult returns the bound module and
explicit TrainState for prediction or advanced workflows.
Application DataModules implement setup(), train_batch_source(), and optionally predict_batch_source().
Prediction is skipped cleanly when a DataModule has no prediction source.
Trainer manages setup and cleanup automatically across fitting and prediction.
Core APIs
Trainer.fit()builds, restores, and trains a module; custom modules overrideconfigure_model().Trainer.predict()consumes aFitResult, or a module blueprint withckpt_pathto predict from a checkpoint.TrainStateholds the functional training state that checkpoints store.BasePhiModuleandPhiModuleprovide overridable fit and prediction hooks without owning optimizers or balancers.PhiDataModuleowns host data and explicit-key batch sources. The Trainer owns device placement.ModelFactoryandInitializedModellet any JAX architecture expose a pure apply callable, state, and summary.LossBalancersupports arbitrary JAX-compatible state and exposes diagnostics without a prescribed state layout.- Derivative, equation, objective, callback, logger, evaluation, and artifact APIs can be reused across projects.
- Hydra instantiation helpers and OmegaConf resolvers are available under
phijax.integrationswithout coupling the Trainer to Hydra.
Only names documented in package __all__ declarations are supported public imports.
Checkpoints and prediction artifacts
PhiJAX saves complete training state in versioned checkpoints and produces portable prediction artifacts for downstream evaluation. Restoration raises an error when a checkpoint version is incompatible.
Development
Install all development dependencies, then enable the repository hooks:
uv sync --group all
uv run --no-sync pre-commit install
Run the local validation suite before submitting a change:
JAX_PLATFORMS=cpu uv run --no-sync pytest
uv run --no-sync ruff check .
uv run --no-sync ruff format --check .
uv run --no-sync pyright
uv run --no-sync mkdocs build --strict
uv run --no-sync pre-commit run --all-files
See the documentation for the complete API and extension guides.
Contributing
Contributions are welcome. Read the contribution guide for the development workflow, testing expectations, documentation requirements, and pull-request checklist.
License
PhiJAX is distributed under the Apache License 2.0.
Metadata
Release files for phijax 0.2.0b6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| phijax-0.2.0b6.tar.gz | 166.0 kB | With provenance | Details for phijax-0.2.0b6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| phijax-0.2.0b6-py3-none-any.whl | Python 3 | none | any | Details for phijax-0.2.0b6-py3-none-any.whl |
Total release size: 378.6 kB
Release files / phijax-0.2.0b6.tar.gz
| Download URL | phijax-0.2.0b6.tar.gz |
|---|---|
| Size | 166.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ee266245280417ddfcb4f6c327d8d6942e68ba533590b15549e1a321db41ddb
|
|
BLAKE2b-256 checksum How to use checksums |
34f4c4678c6e4c4a278ddd822e76321ad2fe1f0aa192bcea2af7c8037ee093b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Transparency logRelease files / phijax-0.2.0b6-py3-none-any.whl
| Download URL | phijax-0.2.0b6-py3-none-any.whl |
|---|---|
| Size | 212.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
767f54007f8be011fda7b25d5e6ba5b141045d5f52de63064dcf796ac807e67d
|
|
BLAKE2b-256 checksum How to use checksums |
ec192158ece1f1b7173ed4953e7e7f565f6f7c892ed0c9468a8acf4fe45515aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Transparency logSecurity for phijax 0.2.0b6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for phijax-0.2.0b6.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.