phijax 0.1.0b1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- phijax-0.1.0b1/LICENSE +201 -0
- phijax-0.1.0b1/PKG-INFO +219 -0
- phijax-0.1.0b1/README.md +173 -0
- phijax-0.1.0b1/pyproject.toml +161 -0
- phijax-0.1.0b1/pyproject.toml.orig +117 -0
- phijax-0.1.0b1/src/phijax/__init__.py +31 -0
- phijax-0.1.0b1/src/phijax/balancers/__init__.py +16 -0
- phijax-0.1.0b1/src/phijax/balancers/base.py +118 -0
- phijax-0.1.0b1/src/phijax/balancers/grad_norm.py +235 -0
- phijax-0.1.0b1/src/phijax/balancers/ntk.py +339 -0
- phijax-0.1.0b1/src/phijax/balancers/static.py +80 -0
- phijax-0.1.0b1/src/phijax/callbacks/__init__.py +29 -0
- phijax-0.1.0b1/src/phijax/callbacks/base.py +224 -0
- phijax-0.1.0b1/src/phijax/callbacks/early_stopping.py +78 -0
- phijax-0.1.0b1/src/phijax/callbacks/learning_rate_monitor.py +172 -0
- phijax-0.1.0b1/src/phijax/callbacks/model_checkpoint.py +230 -0
- phijax-0.1.0b1/src/phijax/callbacks/model_summary.py +75 -0
- phijax-0.1.0b1/src/phijax/callbacks/prediction_writer.py +89 -0
- phijax-0.1.0b1/src/phijax/callbacks/rich_progress_bar.py +435 -0
- phijax-0.1.0b1/src/phijax/data/__init__.py +51 -0
- phijax-0.1.0b1/src/phijax/data/artifacts.py +583 -0
- phijax-0.1.0b1/src/phijax/data/batching.py +49 -0
- phijax-0.1.0b1/src/phijax/data/builders.py +681 -0
- phijax-0.1.0b1/src/phijax/data/datamodule.py +175 -0
- phijax-0.1.0b1/src/phijax/data/io.py +175 -0
- phijax-0.1.0b1/src/phijax/data/pools.py +145 -0
- phijax-0.1.0b1/src/phijax/data/samplers.py +614 -0
- phijax-0.1.0b1/src/phijax/data/sources.py +224 -0
- phijax-0.1.0b1/src/phijax/data/transforms.py +203 -0
- phijax-0.1.0b1/src/phijax/derivatives.py +197 -0
- phijax-0.1.0b1/src/phijax/equations/__init__.py +33 -0
- phijax-0.1.0b1/src/phijax/equations/_common.py +87 -0
- phijax-0.1.0b1/src/phijax/equations/boundary.py +109 -0
- phijax-0.1.0b1/src/phijax/equations/data_fidelity.py +180 -0
- phijax-0.1.0b1/src/phijax/equations/metadata.py +96 -0
- phijax-0.1.0b1/src/phijax/equations/pde/__init__.py +15 -0
- phijax-0.1.0b1/src/phijax/equations/pde/burgers/__init__.py +3 -0
- phijax-0.1.0b1/src/phijax/equations/pde/burgers/one_dimensional.py +95 -0
- phijax-0.1.0b1/src/phijax/equations/pde/navier_stokes/__init__.py +13 -0
- phijax-0.1.0b1/src/phijax/equations/pde/navier_stokes/cartesian.py +217 -0
- phijax-0.1.0b1/src/phijax/equations/pde/navier_stokes/polar.py +159 -0
- phijax-0.1.0b1/src/phijax/equations/pde/navier_stokes/spherical.py +222 -0
- phijax-0.1.0b1/src/phijax/evaluation/__init__.py +33 -0
- phijax-0.1.0b1/src/phijax/evaluation/base.py +36 -0
- phijax-0.1.0b1/src/phijax/evaluation/metrics.py +289 -0
- phijax-0.1.0b1/src/phijax/evaluation/outputs.py +73 -0
- phijax-0.1.0b1/src/phijax/evaluation/regression.py +63 -0
- phijax-0.1.0b1/src/phijax/integrations/__init__.py +1 -0
- phijax-0.1.0b1/src/phijax/integrations/hydra/__init__.py +32 -0
- phijax-0.1.0b1/src/phijax/integrations/hydra/assembly.py +60 -0
- phijax-0.1.0b1/src/phijax/integrations/hydra/factory.py +275 -0
- phijax-0.1.0b1/src/phijax/integrations/omegaconf.py +170 -0
- phijax-0.1.0b1/src/phijax/models/__init__.py +23 -0
- phijax-0.1.0b1/src/phijax/models/activations.py +45 -0
- phijax-0.1.0b1/src/phijax/models/contracts.py +22 -0
- phijax-0.1.0b1/src/phijax/models/initialization.py +38 -0
- phijax-0.1.0b1/src/phijax/models/layers.py +289 -0
- phijax-0.1.0b1/src/phijax/models/mlp.py +294 -0
- phijax-0.1.0b1/src/phijax/models/modified_mlp.py +281 -0
- phijax-0.1.0b1/src/phijax/models/nnx_adapter.py +56 -0
- phijax-0.1.0b1/src/phijax/models/pirate_net.py +394 -0
- phijax-0.1.0b1/src/phijax/models/regularization.py +23 -0
- phijax-0.1.0b1/src/phijax/models/summary.py +49 -0
- phijax-0.1.0b1/src/phijax/module.py +444 -0
- phijax-0.1.0b1/src/phijax/objectives/__init__.py +11 -0
- phijax-0.1.0b1/src/phijax/objectives/base.py +118 -0
- phijax-0.1.0b1/src/phijax/objectives/composite.py +125 -0
- phijax-0.1.0b1/src/phijax/objectives/terms.py +205 -0
- phijax-0.1.0b1/src/phijax/py.typed +0 -0
- phijax-0.1.0b1/src/phijax/training/__init__.py +52 -0
- phijax-0.1.0b1/src/phijax/training/checkpointing.py +297 -0
- phijax-0.1.0b1/src/phijax/training/lifecycle.py +93 -0
- phijax-0.1.0b1/src/phijax/training/loggers.py +420 -0
- phijax-0.1.0b1/src/phijax/training/plans.py +66 -0
- phijax-0.1.0b1/src/phijax/training/precision.py +192 -0
- phijax-0.1.0b1/src/phijax/training/state.py +62 -0
- phijax-0.1.0b1/src/phijax/training/steps.py +195 -0
- phijax-0.1.0b1/src/phijax/training/strategies.py +270 -0
- phijax-0.1.0b1/src/phijax/training/trainer.py +1048 -0
- phijax-0.1.0b1/src/phijax/types.py +93 -0
- phijax-0.1.0b1/src/phijax/utils/__init__.py +23 -0
- phijax-0.1.0b1/src/phijax/utils/format/__init__.py +4 -0
- phijax-0.1.0b1/src/phijax/utils/format/numpy.py +31 -0
- phijax-0.1.0b1/src/phijax/utils/format/omegaconf.py +18 -0
- phijax-0.1.0b1/src/phijax/utils/logging_utils.py +25 -0
- phijax-0.1.0b1/src/phijax/utils/pylogger.py +95 -0
- phijax-0.1.0b1/src/phijax/utils/rich_utils.py +68 -0
- phijax-0.1.0b1/src/phijax/utils/seeding.py +64 -0
- phijax-0.1.0b1/src/phijax/utils/shapes.py +15 -0
- phijax-0.1.0b1/src/phijax/utils/utils.py +156 -0
phijax-0.1.0b1/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
phijax-0.1.0b1/PKG-INFO
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: phijax
|
|
3
|
+
Version: 0.1.0b1
|
|
4
|
+
Summary: A configuration-first JAX framework for training physics-informed neural networks.
|
|
5
|
+
Keywords: jax,physics-informed-neural-networks,pinn,scientific-machine-learning
|
|
6
|
+
Author: Hang Jung Ling
|
|
7
|
+
Author-email: Hang Jung Ling <hangjung.ling@gmail.com>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Dist: colorlog>=6.10,<7
|
|
20
|
+
Requires-Dist: flax==0.12.9
|
|
21
|
+
Requires-Dist: hydra-core==1.3.5
|
|
22
|
+
Requires-Dist: h5py>=3.16,<4
|
|
23
|
+
Requires-Dist: jax==0.11.1
|
|
24
|
+
Requires-Dist: mat73>=0.65,<1
|
|
25
|
+
Requires-Dist: numpy>=2.4,<3
|
|
26
|
+
Requires-Dist: omegaconf==2.3.1
|
|
27
|
+
Requires-Dist: optax==0.2.8
|
|
28
|
+
Requires-Dist: orbax-checkpoint==0.12.4
|
|
29
|
+
Requires-Dist: rich>=15,<16
|
|
30
|
+
Requires-Dist: rootutils>=1.0.7,<2
|
|
31
|
+
Requires-Dist: scipy>=1.17,<2
|
|
32
|
+
Requires-Dist: jax[cuda12]==0.11.1 ; extra == 'cuda12'
|
|
33
|
+
Requires-Dist: jax[cuda13]==0.11.1 ; extra == 'cuda13'
|
|
34
|
+
Requires-Dist: tensorboard>=2.20,<3 ; extra == 'tensorboard'
|
|
35
|
+
Requires-Dist: wandb>=0.29,<0.30 ; extra == 'wandb'
|
|
36
|
+
Requires-Python: >=3.12
|
|
37
|
+
Project-URL: Changelog, https://github.com/HangJung97/PhiJAX/blob/main/CHANGELOG.md
|
|
38
|
+
Project-URL: Documentation, https://hangjung97.github.io/PhiJAX
|
|
39
|
+
Project-URL: Issues, https://github.com/HangJung97/PhiJAX/issues
|
|
40
|
+
Project-URL: Repository, https://github.com/HangJung97/PhiJAX
|
|
41
|
+
Provides-Extra: cuda12
|
|
42
|
+
Provides-Extra: cuda13
|
|
43
|
+
Provides-Extra: tensorboard
|
|
44
|
+
Provides-Extra: wandb
|
|
45
|
+
Description-Content-Type: text/markdown
|
|
46
|
+
|
|
47
|
+
<div align="center">
|
|
48
|
+
|
|
49
|
+
# PhiJAX
|
|
50
|
+
|
|
51
|
+
[](https://github.com/HangJung97/PhiJAX/actions/workflows/code-quality-main.yaml)
|
|
52
|
+
[](https://github.com/HangJung97/PhiJAX/actions/workflows/tests.yaml)
|
|
53
|
+
[](https://github.com/HangJung97/PhiJAX/actions/workflows/docs.yaml)
|
|
54
|
+
[](https://codecov.io/gh/HangJung97/PhiJAX)
|
|
55
|
+
<br>
|
|
56
|
+
[](https://pypi.org/project/phijax/)
|
|
57
|
+
[](https://pypi.org/project/phijax/)
|
|
58
|
+
<br>
|
|
59
|
+
[](LICENSE)
|
|
60
|
+
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
PhiJAX is a typed [JAX](https://docs.jax.dev/) framework for physics-informed neural networks (PINNs). It provides the
|
|
64
|
+
core tools for training PINNs: functional state, explicit-key sampling, reusable equations and objectives, adaptive
|
|
65
|
+
loss balancing, callbacks, logging, checkpointing, and prediction artifacts. Its `Trainer` and `PhiModule` lifecycles
|
|
66
|
+
are inspired by Lightning.
|
|
67
|
+
|
|
68
|
+
For a configuration-first project layout, start from
|
|
69
|
+
[`phijax-hydra-template`](https://github.com/HangJung97/phijax-hydra-template) and customize its entrypoints, Hydra
|
|
70
|
+
configs, and application DataModules.
|
|
71
|
+
|
|
72
|
+
> **Beta API:** PhiJAX `0.1.0b1` defines the first supported public API. Minor changes may still occur before `1.0`.
|
|
73
|
+
> Checkpoints can be restored by compatible PhiJAX releases from the same major and minor version.
|
|
74
|
+
|
|
75
|
+
[Quickstart](https://hangjung97.github.io/PhiJAX/getting-started/quickstart/) |
|
|
76
|
+
[Guides](https://hangjung97.github.io/PhiJAX/guides/datasets/) |
|
|
77
|
+
[API reference](https://hangjung97.github.io/PhiJAX/api/) |
|
|
78
|
+
[Changelog](CHANGELOG.md) |
|
|
79
|
+
[Contributing](CONTRIBUTING.md)
|
|
80
|
+
|
|
81
|
+
## Why PhiJAX?
|
|
82
|
+
|
|
83
|
+
JAX provides automatic differentiation, vectorization, compilation, and accelerator support. PhiJAX adds the
|
|
84
|
+
structure needed to build reproducible, maintainable PINN experiments:
|
|
85
|
+
|
|
86
|
+
- selective coordinate derivatives and reusable PDE, boundary, and data-fidelity equations;
|
|
87
|
+
- named objective terms with static, gradient-norm, and exact-NTK loss balancing;
|
|
88
|
+
- standard MLP, Modified MLP, and adaptive-residual PirateNet architectures with a custom NNX adapter;
|
|
89
|
+
- explicit model, optimizer, balancer, and PRNG state for reproducible compiled updates;
|
|
90
|
+
- familiar, Lightning-inspired lifecycles for trainers, modules, DataModules, callbacks, loggers, and checkpoints; and
|
|
91
|
+
- scientific data preparation on the CPU, automatic batch placement by the Trainer, and prediction files with a
|
|
92
|
+
stable, versioned format.
|
|
93
|
+
|
|
94
|
+
PhiJAX reduces boilerplate for training, prediction, logging, and checkpointing without hiding JAX transformations or
|
|
95
|
+
functional state. Hydra support is optional, and the core Trainer API does not depend on a configuration framework.
|
|
96
|
+
|
|
97
|
+
## Installation
|
|
98
|
+
|
|
99
|
+
PhiJAX requires Python 3.12 or newer. Python 3.12, 3.13, and 3.14 are covered by CI.
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pip install phijax
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The default installation includes CPU-capable JAX. Select one mutually exclusive GPU extra when the matching NVIDIA
|
|
106
|
+
runtime is available:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
pip install "phijax[cuda12]"
|
|
110
|
+
# or
|
|
111
|
+
pip install "phijax[cuda13]"
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Optional experiment loggers are installed separately:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pip install "phijax[tensorboard]"
|
|
118
|
+
pip install "phijax[wandb]"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Extras can be combined when an environment needs GPU support and both logging integrations:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
pip install "phijax[cuda13,wandb,tensorboard]"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Replace `cuda13` with `cuda12` for a CUDA 12 environment; do not install both CUDA extras together.
|
|
128
|
+
|
|
129
|
+
See the [installation guide](https://hangjung97.github.io/PhiJAX/getting-started/installation/) for environment
|
|
130
|
+
verification and development setup.
|
|
131
|
+
|
|
132
|
+
## Quickstart
|
|
133
|
+
|
|
134
|
+
The first runnable example solves a one-dimensional heat equation with initial, boundary, and PDE losses. It uses no
|
|
135
|
+
external data and runs on CPU after JAX completes its initial compilation:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
git clone https://github.com/HangJung97/PhiJAX.git
|
|
139
|
+
cd PhiJAX
|
|
140
|
+
uv sync
|
|
141
|
+
JAX_PLATFORMS=cpu uv run --no-sync python examples/quickstart.py
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`JAX_PLATFORMS=cpu` keeps the whole process strictly CPU-only. This is stronger than selecting
|
|
145
|
+
`Trainer(accelerator="cpu")`, which controls PhiJAX placement without changing JAX's process-wide default backend.
|
|
146
|
+
|
|
147
|
+
Read the [annotated quickstart](https://hangjung97.github.io/PhiJAX/getting-started/quickstart/) for the equation,
|
|
148
|
+
complete source, and an explanation of each runtime object.
|
|
149
|
+
|
|
150
|
+
## Core workflow
|
|
151
|
+
|
|
152
|
+
PhiJAX keeps each part of a PINN workflow explicit:
|
|
153
|
+
|
|
154
|
+
```text
|
|
155
|
+
DataModule -> named batches ---------------------------> Trainer
|
|
156
|
+
|
|
|
157
|
+
InitializedModel -> PhiModule -> named objective losses -------+-> TrainingPlan -> compiled update
|
|
158
|
+
|
|
|
159
|
+
LossBalancer -> weights and diagnostics -----------------------+
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The Trainer prepares data sources, moves batches to devices, runs hooks, restores checkpoints, and cleans up resources.
|
|
163
|
+
`TrainState` holds the model, optimizer, balancer, PRNG, and step values. `TrainingPlan` defines the pure compiled
|
|
164
|
+
update.
|
|
165
|
+
|
|
166
|
+
Application DataModules implement `setup()`, `train_batch_source()`, and optionally `predict_batch_source()`.
|
|
167
|
+
Prediction is skipped cleanly when a DataModule has no prediction source.
|
|
168
|
+
|
|
169
|
+
`Trainer` manages setup and cleanup automatically across fitting and prediction.
|
|
170
|
+
|
|
171
|
+
## Core APIs
|
|
172
|
+
|
|
173
|
+
- `Trainer`, `TrainingPlan`, and `TrainState` separate runtime orchestration from compiled state.
|
|
174
|
+
- `BasePhiModule` and `PhiModule` provide overridable fit and prediction hooks without owning optimizers or balancers.
|
|
175
|
+
- `PhiDataModule` owns host data and explicit-key batch sources. The Trainer owns device placement.
|
|
176
|
+
- `InitializedModel` lets any JAX model factory return an apply callable, functional state, and optional summary.
|
|
177
|
+
- `LossBalancer` supports arbitrary JAX-compatible state and exposes diagnostics without a prescribed state layout.
|
|
178
|
+
- Derivative, equation, objective, callback, logger, evaluation, and artifact APIs can be reused across projects.
|
|
179
|
+
- Hydra instantiation helpers and OmegaConf resolvers are available under `phijax.integrations` without coupling the
|
|
180
|
+
Trainer to Hydra.
|
|
181
|
+
|
|
182
|
+
Only names documented in package `__all__` declarations are supported public imports.
|
|
183
|
+
|
|
184
|
+
## Checkpoints and prediction artifacts
|
|
185
|
+
|
|
186
|
+
PhiJAX saves complete training state in versioned checkpoints and produces portable prediction artifacts for
|
|
187
|
+
downstream evaluation. Restoration raises an error when a checkpoint version is incompatible.
|
|
188
|
+
|
|
189
|
+
## Development
|
|
190
|
+
|
|
191
|
+
Install all development dependencies, then enable the repository hooks:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
uv sync --group all
|
|
195
|
+
uv run --no-sync pre-commit install
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Run the local validation suite before submitting a change:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
JAX_PLATFORMS=cpu uv run --no-sync pytest
|
|
202
|
+
uv run --no-sync ruff check .
|
|
203
|
+
uv run --no-sync ruff format --check .
|
|
204
|
+
uv run --no-sync pyright
|
|
205
|
+
uv run --no-sync mkdocs build --strict
|
|
206
|
+
uv run --no-sync pre-commit run --all-files
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
See the [documentation](https://hangjung97.github.io/PhiJAX/) for the complete API and extension guides.
|
|
210
|
+
|
|
211
|
+
## Contributing
|
|
212
|
+
|
|
213
|
+
Contributions are welcome. Read the
|
|
214
|
+
[contribution guide](https://github.com/HangJung97/PhiJAX/blob/main/CONTRIBUTING.md) for the development workflow,
|
|
215
|
+
testing expectations, documentation requirements, and pull-request checklist.
|
|
216
|
+
|
|
217
|
+
## License
|
|
218
|
+
|
|
219
|
+
PhiJAX is distributed under the [Apache License 2.0](LICENSE).
|
phijax-0.1.0b1/README.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# PhiJAX
|
|
4
|
+
|
|
5
|
+
[](https://github.com/HangJung97/PhiJAX/actions/workflows/code-quality-main.yaml)
|
|
6
|
+
[](https://github.com/HangJung97/PhiJAX/actions/workflows/tests.yaml)
|
|
7
|
+
[](https://github.com/HangJung97/PhiJAX/actions/workflows/docs.yaml)
|
|
8
|
+
[](https://codecov.io/gh/HangJung97/PhiJAX)
|
|
9
|
+
<br>
|
|
10
|
+
[](https://pypi.org/project/phijax/)
|
|
11
|
+
[](https://pypi.org/project/phijax/)
|
|
12
|
+
<br>
|
|
13
|
+
[](LICENSE)
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
PhiJAX is a typed [JAX](https://docs.jax.dev/) framework for physics-informed neural networks (PINNs). It provides the
|
|
18
|
+
core tools for training PINNs: functional state, explicit-key sampling, reusable equations and objectives, adaptive
|
|
19
|
+
loss balancing, callbacks, logging, checkpointing, and prediction artifacts. Its `Trainer` and `PhiModule` lifecycles
|
|
20
|
+
are inspired by Lightning.
|
|
21
|
+
|
|
22
|
+
For a configuration-first project layout, start from
|
|
23
|
+
[`phijax-hydra-template`](https://github.com/HangJung97/phijax-hydra-template) and customize its entrypoints, Hydra
|
|
24
|
+
configs, and application DataModules.
|
|
25
|
+
|
|
26
|
+
> **Beta API:** PhiJAX `0.1.0b1` defines the first supported public API. Minor changes may still occur before `1.0`.
|
|
27
|
+
> Checkpoints can be restored by compatible PhiJAX releases from the same major and minor version.
|
|
28
|
+
|
|
29
|
+
[Quickstart](https://hangjung97.github.io/PhiJAX/getting-started/quickstart/) |
|
|
30
|
+
[Guides](https://hangjung97.github.io/PhiJAX/guides/datasets/) |
|
|
31
|
+
[API reference](https://hangjung97.github.io/PhiJAX/api/) |
|
|
32
|
+
[Changelog](CHANGELOG.md) |
|
|
33
|
+
[Contributing](CONTRIBUTING.md)
|
|
34
|
+
|
|
35
|
+
## Why PhiJAX?
|
|
36
|
+
|
|
37
|
+
JAX provides automatic differentiation, vectorization, compilation, and accelerator support. PhiJAX adds the
|
|
38
|
+
structure needed to build reproducible, maintainable PINN experiments:
|
|
39
|
+
|
|
40
|
+
- selective coordinate derivatives and reusable PDE, boundary, and data-fidelity equations;
|
|
41
|
+
- named objective terms with static, gradient-norm, and exact-NTK loss balancing;
|
|
42
|
+
- standard MLP, Modified MLP, and adaptive-residual PirateNet architectures with a custom NNX adapter;
|
|
43
|
+
- explicit model, optimizer, balancer, and PRNG state for reproducible compiled updates;
|
|
44
|
+
- familiar, Lightning-inspired lifecycles for trainers, modules, DataModules, callbacks, loggers, and checkpoints; and
|
|
45
|
+
- scientific data preparation on the CPU, automatic batch placement by the Trainer, and prediction files with a
|
|
46
|
+
stable, versioned format.
|
|
47
|
+
|
|
48
|
+
PhiJAX reduces boilerplate for training, prediction, logging, and checkpointing without hiding JAX transformations or
|
|
49
|
+
functional state. Hydra support is optional, and the core Trainer API does not depend on a configuration framework.
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
PhiJAX requires Python 3.12 or newer. Python 3.12, 3.13, and 3.14 are covered by CI.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install phijax
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The default installation includes CPU-capable JAX. Select one mutually exclusive GPU extra when the matching NVIDIA
|
|
60
|
+
runtime is available:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install "phijax[cuda12]"
|
|
64
|
+
# or
|
|
65
|
+
pip install "phijax[cuda13]"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Optional experiment loggers are installed separately:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pip install "phijax[tensorboard]"
|
|
72
|
+
pip install "phijax[wandb]"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Extras can be combined when an environment needs GPU support and both logging integrations:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install "phijax[cuda13,wandb,tensorboard]"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Replace `cuda13` with `cuda12` for a CUDA 12 environment; do not install both CUDA extras together.
|
|
82
|
+
|
|
83
|
+
See the [installation guide](https://hangjung97.github.io/PhiJAX/getting-started/installation/) for environment
|
|
84
|
+
verification and development setup.
|
|
85
|
+
|
|
86
|
+
## Quickstart
|
|
87
|
+
|
|
88
|
+
The first runnable example solves a one-dimensional heat equation with initial, boundary, and PDE losses. It uses no
|
|
89
|
+
external data and runs on CPU after JAX completes its initial compilation:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
git clone https://github.com/HangJung97/PhiJAX.git
|
|
93
|
+
cd PhiJAX
|
|
94
|
+
uv sync
|
|
95
|
+
JAX_PLATFORMS=cpu uv run --no-sync python examples/quickstart.py
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
`JAX_PLATFORMS=cpu` keeps the whole process strictly CPU-only. This is stronger than selecting
|
|
99
|
+
`Trainer(accelerator="cpu")`, which controls PhiJAX placement without changing JAX's process-wide default backend.
|
|
100
|
+
|
|
101
|
+
Read the [annotated quickstart](https://hangjung97.github.io/PhiJAX/getting-started/quickstart/) for the equation,
|
|
102
|
+
complete source, and an explanation of each runtime object.
|
|
103
|
+
|
|
104
|
+
## Core workflow
|
|
105
|
+
|
|
106
|
+
PhiJAX keeps each part of a PINN workflow explicit:
|
|
107
|
+
|
|
108
|
+
```text
|
|
109
|
+
DataModule -> named batches ---------------------------> Trainer
|
|
110
|
+
|
|
|
111
|
+
InitializedModel -> PhiModule -> named objective losses -------+-> TrainingPlan -> compiled update
|
|
112
|
+
|
|
|
113
|
+
LossBalancer -> weights and diagnostics -----------------------+
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The Trainer prepares data sources, moves batches to devices, runs hooks, restores checkpoints, and cleans up resources.
|
|
117
|
+
`TrainState` holds the model, optimizer, balancer, PRNG, and step values. `TrainingPlan` defines the pure compiled
|
|
118
|
+
update.
|
|
119
|
+
|
|
120
|
+
Application DataModules implement `setup()`, `train_batch_source()`, and optionally `predict_batch_source()`.
|
|
121
|
+
Prediction is skipped cleanly when a DataModule has no prediction source.
|
|
122
|
+
|
|
123
|
+
`Trainer` manages setup and cleanup automatically across fitting and prediction.
|
|
124
|
+
|
|
125
|
+
## Core APIs
|
|
126
|
+
|
|
127
|
+
- `Trainer`, `TrainingPlan`, and `TrainState` separate runtime orchestration from compiled state.
|
|
128
|
+
- `BasePhiModule` and `PhiModule` provide overridable fit and prediction hooks without owning optimizers or balancers.
|
|
129
|
+
- `PhiDataModule` owns host data and explicit-key batch sources. The Trainer owns device placement.
|
|
130
|
+
- `InitializedModel` lets any JAX model factory return an apply callable, functional state, and optional summary.
|
|
131
|
+
- `LossBalancer` supports arbitrary JAX-compatible state and exposes diagnostics without a prescribed state layout.
|
|
132
|
+
- Derivative, equation, objective, callback, logger, evaluation, and artifact APIs can be reused across projects.
|
|
133
|
+
- Hydra instantiation helpers and OmegaConf resolvers are available under `phijax.integrations` without coupling the
|
|
134
|
+
Trainer to Hydra.
|
|
135
|
+
|
|
136
|
+
Only names documented in package `__all__` declarations are supported public imports.
|
|
137
|
+
|
|
138
|
+
## Checkpoints and prediction artifacts
|
|
139
|
+
|
|
140
|
+
PhiJAX saves complete training state in versioned checkpoints and produces portable prediction artifacts for
|
|
141
|
+
downstream evaluation. Restoration raises an error when a checkpoint version is incompatible.
|
|
142
|
+
|
|
143
|
+
## Development
|
|
144
|
+
|
|
145
|
+
Install all development dependencies, then enable the repository hooks:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
uv sync --group all
|
|
149
|
+
uv run --no-sync pre-commit install
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Run the local validation suite before submitting a change:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
JAX_PLATFORMS=cpu uv run --no-sync pytest
|
|
156
|
+
uv run --no-sync ruff check .
|
|
157
|
+
uv run --no-sync ruff format --check .
|
|
158
|
+
uv run --no-sync pyright
|
|
159
|
+
uv run --no-sync mkdocs build --strict
|
|
160
|
+
uv run --no-sync pre-commit run --all-files
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
See the [documentation](https://hangjung97.github.io/PhiJAX/) for the complete API and extension guides.
|
|
164
|
+
|
|
165
|
+
## Contributing
|
|
166
|
+
|
|
167
|
+
Contributions are welcome. Read the
|
|
168
|
+
[contribution guide](https://github.com/HangJung97/PhiJAX/blob/main/CONTRIBUTING.md) for the development workflow,
|
|
169
|
+
testing expectations, documentation requirements, and pull-request checklist.
|
|
170
|
+
|
|
171
|
+
## License
|
|
172
|
+
|
|
173
|
+
PhiJAX is distributed under the [Apache License 2.0](LICENSE).
|