ihelix 0.1.0__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.
- ihelix-0.1.0/.gitignore +5 -0
- ihelix-0.1.0/LICENSE +203 -0
- ihelix-0.1.0/NOTICE +24 -0
- ihelix-0.1.0/PKG-INFO +179 -0
- ihelix-0.1.0/README.md +146 -0
- ihelix-0.1.0/pyproject.toml +72 -0
- ihelix-0.1.0/src/ihelix/__init__.py +68 -0
- ihelix-0.1.0/src/ihelix/attention.py +465 -0
- ihelix-0.1.0/src/ihelix/cli.py +285 -0
- ihelix-0.1.0/src/ihelix/geometry.py +233 -0
- ihelix-0.1.0/src/ihelix/grid.py +309 -0
- ihelix-0.1.0/src/ihelix/kernels.py +356 -0
- ihelix-0.1.0/src/ihelix/model.py +428 -0
- ihelix-0.1.0/tests/test_ihelix.py +453 -0
ihelix-0.1.0/.gitignore
ADDED
ihelix-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
Copyright 2018- The Hugging Face team. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Apache License
|
|
4
|
+
Version 2.0, January 2004
|
|
5
|
+
http://www.apache.org/licenses/
|
|
6
|
+
|
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
|
+
|
|
9
|
+
1. Definitions.
|
|
10
|
+
|
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
12
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
13
|
+
|
|
14
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
15
|
+
the copyright owner that is granting the License.
|
|
16
|
+
|
|
17
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
18
|
+
other entities that control, are controlled by, or are under common
|
|
19
|
+
control with that entity. For the purposes of this definition,
|
|
20
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
21
|
+
direction or management of such entity, whether by contract or
|
|
22
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
23
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
24
|
+
|
|
25
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
26
|
+
exercising permissions granted by this License.
|
|
27
|
+
|
|
28
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
29
|
+
including but not limited to software source code, documentation
|
|
30
|
+
source, and configuration files.
|
|
31
|
+
|
|
32
|
+
"Object" form shall mean any form resulting from mechanical
|
|
33
|
+
transformation or translation of a Source form, including but
|
|
34
|
+
not limited to compiled object code, generated documentation,
|
|
35
|
+
and conversions to other media types.
|
|
36
|
+
|
|
37
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
38
|
+
Object form, made available under the License, as indicated by a
|
|
39
|
+
copyright notice that is included in or attached to the work
|
|
40
|
+
(an example is provided in the Appendix below).
|
|
41
|
+
|
|
42
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
43
|
+
form, that is based on (or derived from) the Work and for which the
|
|
44
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
45
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
46
|
+
of this License, Derivative Works shall not include works that remain
|
|
47
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
48
|
+
the Work and Derivative Works thereof.
|
|
49
|
+
|
|
50
|
+
"Contribution" shall mean any work of authorship, including
|
|
51
|
+
the original version of the Work and any modifications or additions
|
|
52
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
53
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
54
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
55
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
56
|
+
means any form of electronic, verbal, or written communication sent
|
|
57
|
+
to the Licensor or its representatives, including but not limited to
|
|
58
|
+
communication on electronic mailing lists, source code control systems,
|
|
59
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
60
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
61
|
+
excluding communication that is conspicuously marked or otherwise
|
|
62
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
63
|
+
|
|
64
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
65
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
66
|
+
subsequently incorporated within the Work.
|
|
67
|
+
|
|
68
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
69
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
70
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
71
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
72
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
73
|
+
Work and such Derivative Works in Source or Object form.
|
|
74
|
+
|
|
75
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
76
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
77
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
78
|
+
(except as stated in this section) patent license to make, have made,
|
|
79
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
80
|
+
where such license applies only to those patent claims licensable
|
|
81
|
+
by such Contributor that are necessarily infringed by their
|
|
82
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
83
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
84
|
+
institute patent litigation against any entity (including a
|
|
85
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
86
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
87
|
+
or contributory patent infringement, then any patent licenses
|
|
88
|
+
granted to You under this License for that Work shall terminate
|
|
89
|
+
as of the date such litigation is filed.
|
|
90
|
+
|
|
91
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
92
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
93
|
+
modifications, and in Source or Object form, provided that You
|
|
94
|
+
meet the following conditions:
|
|
95
|
+
|
|
96
|
+
(a) You must give any other recipients of the Work or
|
|
97
|
+
Derivative Works a copy of this License; and
|
|
98
|
+
|
|
99
|
+
(b) You must cause any modified files to carry prominent notices
|
|
100
|
+
stating that You changed the files; and
|
|
101
|
+
|
|
102
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
103
|
+
that You distribute, all copyright, patent, trademark, and
|
|
104
|
+
attribution notices from the Source form of the Work,
|
|
105
|
+
excluding those notices that do not pertain to any part of
|
|
106
|
+
the Derivative Works; and
|
|
107
|
+
|
|
108
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
109
|
+
distribution, then any Derivative Works that You distribute must
|
|
110
|
+
include a readable copy of the attribution notices contained
|
|
111
|
+
within such NOTICE file, excluding those notices that do not
|
|
112
|
+
pertain to any part of the Derivative Works, in at least one
|
|
113
|
+
of the following places: within a NOTICE text file distributed
|
|
114
|
+
as part of the Derivative Works; within the Source form or
|
|
115
|
+
documentation, if provided along with the Derivative Works; or,
|
|
116
|
+
within a display generated by the Derivative Works, if and
|
|
117
|
+
wherever such third-party notices normally appear. The contents
|
|
118
|
+
of the NOTICE file are for informational purposes only and
|
|
119
|
+
do not modify the License. You may add Your own attribution
|
|
120
|
+
notices within Derivative Works that You distribute, alongside
|
|
121
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
122
|
+
that such additional attribution notices cannot be construed
|
|
123
|
+
as modifying the License.
|
|
124
|
+
|
|
125
|
+
You may add Your own copyright statement to Your modifications and
|
|
126
|
+
may provide additional or different license terms and conditions
|
|
127
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
128
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
129
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
130
|
+
the conditions stated in this License.
|
|
131
|
+
|
|
132
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
133
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
134
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
135
|
+
this License, without any additional terms or conditions.
|
|
136
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
137
|
+
the terms of any separate license agreement you may have executed
|
|
138
|
+
with Licensor regarding such Contributions.
|
|
139
|
+
|
|
140
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
141
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
142
|
+
except as required for reasonable and customary use in describing the
|
|
143
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
144
|
+
|
|
145
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
146
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
147
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
148
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
149
|
+
implied, including, without limitation, any warranties or conditions
|
|
150
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
151
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
152
|
+
appropriateness of using or redistributing the Work and assume any
|
|
153
|
+
risks associated with Your exercise of permissions under this License.
|
|
154
|
+
|
|
155
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
156
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
157
|
+
unless required by applicable law (such as deliberate and grossly
|
|
158
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
159
|
+
liable to You for damages, including any direct, indirect, special,
|
|
160
|
+
incidental, or consequential damages of any character arising as a
|
|
161
|
+
result of this License or out of the use or inability to use the
|
|
162
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
163
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
164
|
+
other commercial damages or losses), even if such Contributor
|
|
165
|
+
has been advised of the possibility of such damages.
|
|
166
|
+
|
|
167
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
168
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
169
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
170
|
+
or other liability obligations and/or rights consistent with this
|
|
171
|
+
License. However, in accepting such obligations, You may act only
|
|
172
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
173
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
174
|
+
defend, and hold each Contributor harmless for any liability
|
|
175
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
176
|
+
of your accepting any such warranty or additional liability.
|
|
177
|
+
|
|
178
|
+
END OF TERMS AND CONDITIONS
|
|
179
|
+
|
|
180
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
181
|
+
|
|
182
|
+
To apply the Apache License to your work, attach the following
|
|
183
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
184
|
+
replaced with your own identifying information. (Don't include
|
|
185
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
186
|
+
comment syntax for the file format. We also recommend that a
|
|
187
|
+
file or class name and description of purpose be included on the
|
|
188
|
+
same "printed page" as the copyright notice for easier
|
|
189
|
+
identification within third-party archives.
|
|
190
|
+
|
|
191
|
+
Copyright [yyyy] [name of copyright owner]
|
|
192
|
+
|
|
193
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
194
|
+
you may not use this file except in compliance with the License.
|
|
195
|
+
You may obtain a copy of the License at
|
|
196
|
+
|
|
197
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
198
|
+
|
|
199
|
+
Unless required by applicable law or agreed to in writing, software
|
|
200
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
201
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
|
+
See the License for the specific language governing permissions and
|
|
203
|
+
limitations under the License.
|
ihelix-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
ihelix
|
|
2
|
+
Copyright 2026 Nathan
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
5
|
+
these files except in compliance with the License. A copy of the License is in
|
|
6
|
+
the LICENSE file.
|
|
7
|
+
|
|
8
|
+
--------------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
This product includes software developed at Hugging Face, Inc.
|
|
11
|
+
|
|
12
|
+
`ihelix/kernels.py` carries over the RMS normalization layers, the depthwise
|
|
13
|
+
causal convolution, the chunkwise-parallel and single-step gated delta-rule
|
|
14
|
+
routines, the landmark pooler and `repeat_kv` from the `helix-lm` package, which
|
|
15
|
+
in turn follows the reference implementations in HuggingFace Transformers
|
|
16
|
+
(https://github.com/huggingface/transformers), licensed under the Apache
|
|
17
|
+
License, Version 2.0.
|
|
18
|
+
|
|
19
|
+
Original to this project: the geometry layer (metric-space embedding of
|
|
20
|
+
spherical, periodic, linear and logarithmic axes, and the local frames built on
|
|
21
|
+
them), the grid layer (neighbour graphs and principal-axis spatial hierarchies),
|
|
22
|
+
geodesic neighbourhood attention with compactly supported physical receptive
|
|
23
|
+
fields and quadrature weighting, the content-addressed regional index, the
|
|
24
|
+
cross-grid reader, and the encode-process-decode model built from them.
|
ihelix-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: ihelix
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: One architecture for fields on any geometry: spheres, grids, volumes, periodic boxes and point clouds
|
|
5
|
+
Project-URL: Homepage, https://github.com/Wisk-inc/transformers/tree/main/ihelix
|
|
6
|
+
Project-URL: Source, https://github.com/Wisk-inc/transformers/tree/main/ihelix
|
|
7
|
+
Project-URL: Issues, https://github.com/Wisk-inc/transformers/issues
|
|
8
|
+
Author: Nathan
|
|
9
|
+
Maintainer: Nathan
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: NOTICE
|
|
13
|
+
Keywords: attention,climate,fluid-dynamics,geometric-deep-learning,neural-operator,physics,point-cloud,pytorch,resolution-invariant,spherical,transformer,weather
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
25
|
+
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
|
|
26
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
27
|
+
Requires-Python: >=3.10
|
|
28
|
+
Requires-Dist: torch>=2.5
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
31
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# iHELIX
|
|
35
|
+
|
|
36
|
+
**One architecture for fields on any geometry.** Spheres, images, volumes, periodic boxes, particle
|
|
37
|
+
clouds, and whatever you describe next.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install ihelix
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import torch
|
|
45
|
+
from ihelix import Axis, Geometry, FieldGrid, IHelixConfig, IHelixField
|
|
46
|
+
|
|
47
|
+
geometry = Geometry.atmosphere() # (latitude, longitude, pressure)
|
|
48
|
+
grid = FieldGrid.from_points(coords, geometry, num_neighbours=64, cluster_size=64)
|
|
49
|
+
model = IHelixField(IHelixConfig(in_channels=8), geometry)
|
|
50
|
+
|
|
51
|
+
forecast = model(fields, grid) # (B, T, N, C) in, same out
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
ihelix info # what it is and which geometries it covers
|
|
56
|
+
ihelix domains # run every shape of problem through one class
|
|
57
|
+
ihelix converge # read one field at rising resolution
|
|
58
|
+
ihelix demo # build a model and check the invariances
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## The problem
|
|
64
|
+
|
|
65
|
+
Flatten a 3-D atmosphere into a 1-D sequence and the model has to learn spherical topology from scratch,
|
|
66
|
+
because nothing in an index tells it. Rotary embeddings do not help: they encode distance in *array
|
|
67
|
+
steps*, and on a latitude-longitude grid an array step means different things in different places.
|
|
68
|
+
|
|
69
|
+
- Cells one row apart sit `n_lon` positions apart in the sequence.
|
|
70
|
+
- The date line becomes a cliff: longitude 359.9° and 0.1° are neighbours on the planet and thousands of
|
|
71
|
+
positions apart in the array.
|
|
72
|
+
- The meridians converge. Near the pole, a step of longitude is a few hundred metres; at the equator it is
|
|
73
|
+
a hundred kilometres. The sequence calls both "one step".
|
|
74
|
+
|
|
75
|
+
A multi-mesh GNN fixes the topology by building the geometry into the wiring, which is honest but rigid:
|
|
76
|
+
the mesh is chosen up front, reaching across the domain costs hops, and a new resolution means a new mesh.
|
|
77
|
+
|
|
78
|
+
## The approach
|
|
79
|
+
|
|
80
|
+
Declare what your axes *are*. Everything downstream then works in a metric space where the geometry is
|
|
81
|
+
already correct, and no part of the model ever sees an index.
|
|
82
|
+
|
|
83
|
+
| you write | it becomes | which fixes |
|
|
84
|
+
| --- | --- | --- |
|
|
85
|
+
| `Axis("spherical")` | a point on a sphere in 3-D | the date line stops existing; the poles become ordinary points |
|
|
86
|
+
| `Axis("periodic", period=L)` | a point on a circle | a channel-flow box wraps because it *is* wrapped |
|
|
87
|
+
| `Axis("log", reference=1000)` | log-pressure | a factor of two in pressure is one distance, everywhere |
|
|
88
|
+
| `Axis("linear", scale=s)` | itself, scaled | a kilometre up is not a kilometre sideways, and you say by how much |
|
|
89
|
+
|
|
90
|
+
Three things follow, and they are what the package actually is:
|
|
91
|
+
|
|
92
|
+
**Neighbours are the nearest samples on the manifold**, not the adjacent entries in an array. A sample
|
|
93
|
+
beside the date line draws neighbours from both sides of it, because they are near.
|
|
94
|
+
|
|
95
|
+
**Displacements are expressed in each sample's own local frame** — east, north, up. "300 km east" produces
|
|
96
|
+
the same input vector at the equator and at 70°N. Polar distortion is not corrected; it is never
|
|
97
|
+
introduced.
|
|
98
|
+
|
|
99
|
+
**Receptive fields are lengths, and attention is weighted by area.** Each head carries a physical radius
|
|
100
|
+
with compact support, and every sample is weighted by the share of the domain it stands for. Attention
|
|
101
|
+
becomes a quadrature of a continuous operator,
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
out(x) = ∫ a(x,y) v(y) dμ(y) / ∫ a(x,y) dμ(y)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
estimated on whatever samples you have. Refine the grid and it converges instead of drifting.
|
|
108
|
+
|
|
109
|
+
## The three strands
|
|
110
|
+
|
|
111
|
+
The braid from [`helix-lm`](../helix-lm), with "position in a sequence" replaced by "position on a
|
|
112
|
+
manifold" in the two spatial strands:
|
|
113
|
+
|
|
114
|
+
| strand | reads | cost |
|
|
115
|
+
| --- | --- | --- |
|
|
116
|
+
| **local** | nearest neighbours in metric space, per-head physical radii | `O(N · K)` |
|
|
117
|
+
| **index** | whole regions of the domain, retrieved by content through a hierarchy | `O(N · topk · cluster)` |
|
|
118
|
+
| **time** | a gated delta rule along the one axis that has an order | `O(T)`, fixed state per sample |
|
|
119
|
+
|
|
120
|
+
The **index** strand is the part a fixed mesh cannot do. Message passing couples regions by distance along
|
|
121
|
+
edges chosen in advance, so reaching the far side costs hops. Here the route is content-addressed and
|
|
122
|
+
learned: a ridge over the Atlantic can read the Pacific in one step, and nothing in the wiring had to
|
|
123
|
+
anticipate it. Teleconnections, distant vortices, the other side of an image — same mechanism.
|
|
124
|
+
|
|
125
|
+
Space has no order, so nothing recurrent runs across it. **Time** does, and that is the only place a
|
|
126
|
+
recurrence appears. Its state is a matrix per sample that does not grow with the rollout, so frame 1000
|
|
127
|
+
costs what frame 1 costs.
|
|
128
|
+
|
|
129
|
+
## What has been measured
|
|
130
|
+
|
|
131
|
+
On untrained models — these are properties of the arithmetic, not of training.
|
|
132
|
+
|
|
133
|
+
| property | result |
|
|
134
|
+
| --- | --- |
|
|
135
|
+
| **Sample order carries no information** | **exactly 0** difference under a full shuffle |
|
|
136
|
+
| **Longitude shift changes nothing** (local strand) | `1.8e-08` — float64 round-off |
|
|
137
|
+
| Refining 16×32 → 24×48 → 32×64, vs the finest | `0.455% → 0.174% → 0.090%`, halving each time |
|
|
138
|
+
| One class over image / video / volume / periodic box / point cloud / 1-D / globe / atmosphere | all run, all at full coverage |
|
|
139
|
+
| Time is causal; editing frame 5 leaves frames 0–4 | **exactly 0** |
|
|
140
|
+
| Temporal state size across 4, 32, 128 frames | identical |
|
|
141
|
+
|
|
142
|
+
The first row is the formal statement of "no flattening artefact", and it is exact rather than
|
|
143
|
+
approximate. A sequence model reading a flattened grid cannot say the same at any precision.
|
|
144
|
+
|
|
145
|
+
## The one precondition
|
|
146
|
+
|
|
147
|
+
Fixed-count neighbourhoods and fixed-length receptive fields pull against each other: refine the grid and
|
|
148
|
+
a fixed count covers less ground. Every attention module reports whether its neighbour list actually
|
|
149
|
+
reaches its radius:
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
grid = FieldGrid.from_points(coords, geometry, num_neighbours=grid.suggest_neighbours(radius))
|
|
153
|
+
model.blocks[0].local.coverage(grid) # 1.0 = every head decided by its radius, not by the list length
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
At `1.0` the invariances above are exact. Below it they degrade smoothly, and the number tells you so.
|
|
157
|
+
The neighbour count is a preprocessing choice — the weights never change.
|
|
158
|
+
|
|
159
|
+
## Honest limits
|
|
160
|
+
|
|
161
|
+
- **No trained checkpoints.** Nothing here has been trained on real data. Every claim above is about
|
|
162
|
+
geometry, invariance and complexity, not about forecast skill or sample quality.
|
|
163
|
+
- **The region partition is a discretization.** The index strand carves the domain into regions, and no
|
|
164
|
+
finite partition of a sphere commutes with arbitrary rotation — a fixed icosahedral mesh has exactly the
|
|
165
|
+
same property. A longitude shift moves the local strand by round-off and the full model by ~5e-2.
|
|
166
|
+
- **Neighbour counts grow with density.** Holding a fixed physical reach at 4× the samples needs ~4× the
|
|
167
|
+
neighbours. That is inherent to fixed-count neighbourhoods; `suggest_neighbours` computes it.
|
|
168
|
+
- **Vectors are not parallel-transported.** Components are read in each sample's local frame and the
|
|
169
|
+
frame rotation is supplied to the model, but nothing forces it to transport them correctly.
|
|
170
|
+
- **Brute-force neighbour search.** Exact and cached per grid, which is right when the grid is static.
|
|
171
|
+
Pass a precomputed index for very large point sets.
|
|
172
|
+
|
|
173
|
+
## License
|
|
174
|
+
|
|
175
|
+
Apache-2.0. The normalization, convolution, delta-rule and pooling kernels carry over from `helix-lm` and
|
|
176
|
+
ultimately from [HuggingFace Transformers](https://github.com/huggingface/transformers) (Apache-2.0); see
|
|
177
|
+
`NOTICE`. The geometry, grid, geodesic attention, regional index and cross-grid reader are original.
|
|
178
|
+
|
|
179
|
+
**Made by Nathan.**
|
ihelix-0.1.0/README.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# iHELIX
|
|
2
|
+
|
|
3
|
+
**One architecture for fields on any geometry.** Spheres, images, volumes, periodic boxes, particle
|
|
4
|
+
clouds, and whatever you describe next.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
pip install ihelix
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```python
|
|
11
|
+
import torch
|
|
12
|
+
from ihelix import Axis, Geometry, FieldGrid, IHelixConfig, IHelixField
|
|
13
|
+
|
|
14
|
+
geometry = Geometry.atmosphere() # (latitude, longitude, pressure)
|
|
15
|
+
grid = FieldGrid.from_points(coords, geometry, num_neighbours=64, cluster_size=64)
|
|
16
|
+
model = IHelixField(IHelixConfig(in_channels=8), geometry)
|
|
17
|
+
|
|
18
|
+
forecast = model(fields, grid) # (B, T, N, C) in, same out
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
ihelix info # what it is and which geometries it covers
|
|
23
|
+
ihelix domains # run every shape of problem through one class
|
|
24
|
+
ihelix converge # read one field at rising resolution
|
|
25
|
+
ihelix demo # build a model and check the invariances
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## The problem
|
|
31
|
+
|
|
32
|
+
Flatten a 3-D atmosphere into a 1-D sequence and the model has to learn spherical topology from scratch,
|
|
33
|
+
because nothing in an index tells it. Rotary embeddings do not help: they encode distance in *array
|
|
34
|
+
steps*, and on a latitude-longitude grid an array step means different things in different places.
|
|
35
|
+
|
|
36
|
+
- Cells one row apart sit `n_lon` positions apart in the sequence.
|
|
37
|
+
- The date line becomes a cliff: longitude 359.9° and 0.1° are neighbours on the planet and thousands of
|
|
38
|
+
positions apart in the array.
|
|
39
|
+
- The meridians converge. Near the pole, a step of longitude is a few hundred metres; at the equator it is
|
|
40
|
+
a hundred kilometres. The sequence calls both "one step".
|
|
41
|
+
|
|
42
|
+
A multi-mesh GNN fixes the topology by building the geometry into the wiring, which is honest but rigid:
|
|
43
|
+
the mesh is chosen up front, reaching across the domain costs hops, and a new resolution means a new mesh.
|
|
44
|
+
|
|
45
|
+
## The approach
|
|
46
|
+
|
|
47
|
+
Declare what your axes *are*. Everything downstream then works in a metric space where the geometry is
|
|
48
|
+
already correct, and no part of the model ever sees an index.
|
|
49
|
+
|
|
50
|
+
| you write | it becomes | which fixes |
|
|
51
|
+
| --- | --- | --- |
|
|
52
|
+
| `Axis("spherical")` | a point on a sphere in 3-D | the date line stops existing; the poles become ordinary points |
|
|
53
|
+
| `Axis("periodic", period=L)` | a point on a circle | a channel-flow box wraps because it *is* wrapped |
|
|
54
|
+
| `Axis("log", reference=1000)` | log-pressure | a factor of two in pressure is one distance, everywhere |
|
|
55
|
+
| `Axis("linear", scale=s)` | itself, scaled | a kilometre up is not a kilometre sideways, and you say by how much |
|
|
56
|
+
|
|
57
|
+
Three things follow, and they are what the package actually is:
|
|
58
|
+
|
|
59
|
+
**Neighbours are the nearest samples on the manifold**, not the adjacent entries in an array. A sample
|
|
60
|
+
beside the date line draws neighbours from both sides of it, because they are near.
|
|
61
|
+
|
|
62
|
+
**Displacements are expressed in each sample's own local frame** — east, north, up. "300 km east" produces
|
|
63
|
+
the same input vector at the equator and at 70°N. Polar distortion is not corrected; it is never
|
|
64
|
+
introduced.
|
|
65
|
+
|
|
66
|
+
**Receptive fields are lengths, and attention is weighted by area.** Each head carries a physical radius
|
|
67
|
+
with compact support, and every sample is weighted by the share of the domain it stands for. Attention
|
|
68
|
+
becomes a quadrature of a continuous operator,
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
out(x) = ∫ a(x,y) v(y) dμ(y) / ∫ a(x,y) dμ(y)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
estimated on whatever samples you have. Refine the grid and it converges instead of drifting.
|
|
75
|
+
|
|
76
|
+
## The three strands
|
|
77
|
+
|
|
78
|
+
The braid from [`helix-lm`](../helix-lm), with "position in a sequence" replaced by "position on a
|
|
79
|
+
manifold" in the two spatial strands:
|
|
80
|
+
|
|
81
|
+
| strand | reads | cost |
|
|
82
|
+
| --- | --- | --- |
|
|
83
|
+
| **local** | nearest neighbours in metric space, per-head physical radii | `O(N · K)` |
|
|
84
|
+
| **index** | whole regions of the domain, retrieved by content through a hierarchy | `O(N · topk · cluster)` |
|
|
85
|
+
| **time** | a gated delta rule along the one axis that has an order | `O(T)`, fixed state per sample |
|
|
86
|
+
|
|
87
|
+
The **index** strand is the part a fixed mesh cannot do. Message passing couples regions by distance along
|
|
88
|
+
edges chosen in advance, so reaching the far side costs hops. Here the route is content-addressed and
|
|
89
|
+
learned: a ridge over the Atlantic can read the Pacific in one step, and nothing in the wiring had to
|
|
90
|
+
anticipate it. Teleconnections, distant vortices, the other side of an image — same mechanism.
|
|
91
|
+
|
|
92
|
+
Space has no order, so nothing recurrent runs across it. **Time** does, and that is the only place a
|
|
93
|
+
recurrence appears. Its state is a matrix per sample that does not grow with the rollout, so frame 1000
|
|
94
|
+
costs what frame 1 costs.
|
|
95
|
+
|
|
96
|
+
## What has been measured
|
|
97
|
+
|
|
98
|
+
On untrained models — these are properties of the arithmetic, not of training.
|
|
99
|
+
|
|
100
|
+
| property | result |
|
|
101
|
+
| --- | --- |
|
|
102
|
+
| **Sample order carries no information** | **exactly 0** difference under a full shuffle |
|
|
103
|
+
| **Longitude shift changes nothing** (local strand) | `1.8e-08` — float64 round-off |
|
|
104
|
+
| Refining 16×32 → 24×48 → 32×64, vs the finest | `0.455% → 0.174% → 0.090%`, halving each time |
|
|
105
|
+
| One class over image / video / volume / periodic box / point cloud / 1-D / globe / atmosphere | all run, all at full coverage |
|
|
106
|
+
| Time is causal; editing frame 5 leaves frames 0–4 | **exactly 0** |
|
|
107
|
+
| Temporal state size across 4, 32, 128 frames | identical |
|
|
108
|
+
|
|
109
|
+
The first row is the formal statement of "no flattening artefact", and it is exact rather than
|
|
110
|
+
approximate. A sequence model reading a flattened grid cannot say the same at any precision.
|
|
111
|
+
|
|
112
|
+
## The one precondition
|
|
113
|
+
|
|
114
|
+
Fixed-count neighbourhoods and fixed-length receptive fields pull against each other: refine the grid and
|
|
115
|
+
a fixed count covers less ground. Every attention module reports whether its neighbour list actually
|
|
116
|
+
reaches its radius:
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
grid = FieldGrid.from_points(coords, geometry, num_neighbours=grid.suggest_neighbours(radius))
|
|
120
|
+
model.blocks[0].local.coverage(grid) # 1.0 = every head decided by its radius, not by the list length
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
At `1.0` the invariances above are exact. Below it they degrade smoothly, and the number tells you so.
|
|
124
|
+
The neighbour count is a preprocessing choice — the weights never change.
|
|
125
|
+
|
|
126
|
+
## Honest limits
|
|
127
|
+
|
|
128
|
+
- **No trained checkpoints.** Nothing here has been trained on real data. Every claim above is about
|
|
129
|
+
geometry, invariance and complexity, not about forecast skill or sample quality.
|
|
130
|
+
- **The region partition is a discretization.** The index strand carves the domain into regions, and no
|
|
131
|
+
finite partition of a sphere commutes with arbitrary rotation — a fixed icosahedral mesh has exactly the
|
|
132
|
+
same property. A longitude shift moves the local strand by round-off and the full model by ~5e-2.
|
|
133
|
+
- **Neighbour counts grow with density.** Holding a fixed physical reach at 4× the samples needs ~4× the
|
|
134
|
+
neighbours. That is inherent to fixed-count neighbourhoods; `suggest_neighbours` computes it.
|
|
135
|
+
- **Vectors are not parallel-transported.** Components are read in each sample's local frame and the
|
|
136
|
+
frame rotation is supplied to the model, but nothing forces it to transport them correctly.
|
|
137
|
+
- **Brute-force neighbour search.** Exact and cached per grid, which is right when the grid is static.
|
|
138
|
+
Pass a precomputed index for very large point sets.
|
|
139
|
+
|
|
140
|
+
## License
|
|
141
|
+
|
|
142
|
+
Apache-2.0. The normalization, convolution, delta-rule and pooling kernels carry over from `helix-lm` and
|
|
143
|
+
ultimately from [HuggingFace Transformers](https://github.com/huggingface/transformers) (Apache-2.0); see
|
|
144
|
+
`NOTICE`. The geometry, grid, geodesic attention, regional index and cross-grid reader are original.
|
|
145
|
+
|
|
146
|
+
**Made by Nathan.**
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ihelix"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "One architecture for fields on any geometry: spheres, grids, volumes, periodic boxes and point clouds"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE", "NOTICE"]
|
|
13
|
+
authors = [{ name = "Nathan" }]
|
|
14
|
+
maintainers = [{ name = "Nathan" }]
|
|
15
|
+
keywords = [
|
|
16
|
+
"geometric-deep-learning",
|
|
17
|
+
"attention",
|
|
18
|
+
"transformer",
|
|
19
|
+
"weather",
|
|
20
|
+
"climate",
|
|
21
|
+
"spherical",
|
|
22
|
+
"point-cloud",
|
|
23
|
+
"neural-operator",
|
|
24
|
+
"physics",
|
|
25
|
+
"fluid-dynamics",
|
|
26
|
+
"resolution-invariant",
|
|
27
|
+
"pytorch",
|
|
28
|
+
]
|
|
29
|
+
classifiers = [
|
|
30
|
+
"Development Status :: 3 - Alpha",
|
|
31
|
+
"Intended Audience :: Developers",
|
|
32
|
+
"Intended Audience :: Science/Research",
|
|
33
|
+
"License :: OSI Approved :: Apache Software License",
|
|
34
|
+
"Operating System :: OS Independent",
|
|
35
|
+
"Programming Language :: Python :: 3",
|
|
36
|
+
"Programming Language :: Python :: 3.10",
|
|
37
|
+
"Programming Language :: Python :: 3.11",
|
|
38
|
+
"Programming Language :: Python :: 3.12",
|
|
39
|
+
"Programming Language :: Python :: 3.13",
|
|
40
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
41
|
+
"Topic :: Scientific/Engineering :: Atmospheric Science",
|
|
42
|
+
"Topic :: Scientific/Engineering :: Physics",
|
|
43
|
+
]
|
|
44
|
+
dependencies = ["torch>=2.5"]
|
|
45
|
+
|
|
46
|
+
[project.optional-dependencies]
|
|
47
|
+
dev = ["pytest>=7", "ruff>=0.6"]
|
|
48
|
+
|
|
49
|
+
[project.urls]
|
|
50
|
+
Homepage = "https://github.com/Wisk-inc/transformers/tree/main/ihelix"
|
|
51
|
+
Source = "https://github.com/Wisk-inc/transformers/tree/main/ihelix"
|
|
52
|
+
Issues = "https://github.com/Wisk-inc/transformers/issues"
|
|
53
|
+
|
|
54
|
+
[project.scripts]
|
|
55
|
+
ihelix = "ihelix.cli:main"
|
|
56
|
+
|
|
57
|
+
[tool.hatch.build.targets.wheel]
|
|
58
|
+
packages = ["src/ihelix"]
|
|
59
|
+
|
|
60
|
+
[tool.hatch.build.targets.sdist]
|
|
61
|
+
include = ["src/ihelix", "tests", "README.md", "LICENSE", "NOTICE", "pyproject.toml"]
|
|
62
|
+
|
|
63
|
+
[tool.ruff]
|
|
64
|
+
line-length = 119
|
|
65
|
+
target-version = "py310"
|
|
66
|
+
|
|
67
|
+
[tool.ruff.lint]
|
|
68
|
+
select = ["E", "F", "W", "I", "UP", "B", "C4", "SIM"]
|
|
69
|
+
ignore = ["B008", "E741"]
|
|
70
|
+
|
|
71
|
+
[tool.pytest.ini_options]
|
|
72
|
+
testpaths = ["tests"]
|