Commit
Β·
ac1fa8d
1
Parent(s):
2da731b
update readme
Browse files
README.md
CHANGED
@@ -1,3 +1,106 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
library_name: flax
|
4 |
+
pipeline_tag: other
|
5 |
+
tags:
|
6 |
+
- neural-fields
|
7 |
+
- general-relativity
|
8 |
+
- physics
|
9 |
+
- jax
|
10 |
+
- flax
|
11 |
+
- siren
|
12 |
+
- wire
|
13 |
+
- mlp
|
14 |
---
|
15 |
+
|
16 |
+
# EinFields: Neural Implicit Representations for General Relativity
|
17 |
+
|
18 |
+
EinFields is a JAX/Flax-based library for learning neural implicit representations of spacetime metrics in General Relativity. The repository provides pre-trained models on various neural network architectures: MLP, SIREN, WIRE.
|
19 |
+
|
20 |
+
## Overview
|
21 |
+
|
22 |
+
This model HF repository contains plenty of pre-trained models. The reason for so many is that geodesics require different training domains, although it would've been possible and cleaner to enlarge this domain and have only one model.
|
23 |
+
|
24 |
+
Watch for `metric_type` in the `architecture.yml` as it says if the model is trained on the full metric or distortion. If distortion, then you can combine with the Minkowski metrics from our Github repo to get the full one.
|
25 |
+
|
26 |
+
Also, very important to have a look at `train_data.yml` to see what was the training grid on which the model was trained.
|
27 |
+
|
28 |
+
|
29 |
+
|
30 |
+
## Repository Structure
|
31 |
+
|
32 |
+
```
|
33 |
+
EinFields/
|
34 |
+
βββ flax_models/ # Core model implementations
|
35 |
+
β βββ __init__.py # Model factory and utilities
|
36 |
+
β βββ activations.py # Activation functions
|
37 |
+
β βββ mlp.py # Multi-Layer Perceptron
|
38 |
+
β βββ siren.py # SIREN architecture
|
39 |
+
β βββ wire.py # WIRE
|
40 |
+
βββ gw/ # GW metrics
|
41 |
+
β βββ cartesian/
|
42 |
+
β βββ silu/ # SILU activation models
|
43 |
+
β βββ siren/ # SIREN models
|
44 |
+
β βββ wire/ # WIRE models
|
45 |
+
βββ schwarzschild/ # Schwarzschild black hole models
|
46 |
+
β βββ spherical/
|
47 |
+
β βββ close_event_horizon/
|
48 |
+
β βββ perihelion/
|
49 |
+
βββ kerr/ # Kerr black hole models
|
50 |
+
β βββ boyer_lindquist/
|
51 |
+
βββ βββ kerr_schild_cartesian/
|
52 |
+
```
|
53 |
+
|
54 |
+
Each model directory contains:
|
55 |
+
- `architecture.yml`: Model configuration
|
56 |
+
- `params.msgpack`: Model parameters
|
57 |
+
- `train_data.yml`: Training grid info
|
58 |
+
|
59 |
+
### Loading Models
|
60 |
+
|
61 |
+
```python
|
62 |
+
from huggingface_hub import hf_hub_download, snapshot_download
|
63 |
+
import os
|
64 |
+
|
65 |
+
# First option: get the full repository
|
66 |
+
repo_path = snapshot_download(repo_id="AndreiB137/EinFields")
|
67 |
+
# or clone the repository if you prefer
|
68 |
+
|
69 |
+
# Second option: get only flax_models and the model file you want
|
70 |
+
|
71 |
+
flax_models_folder = snapshot_download(
|
72 |
+
repo_id="AndreiB137/EinFields",
|
73 |
+
allow_patterns="flax_models/*"
|
74 |
+
)
|
75 |
+
|
76 |
+
model_folder = snapshot_download(
|
77 |
+
repo_id="AndreiB137/EinFields",
|
78 |
+
allow_patterns="kerr/boyer_lindquist/prograde/*"
|
79 |
+
)
|
80 |
+
|
81 |
+
# Then move the content in flax_models_folder to a directory where you are working with flax_models folder name. Afterwads:
|
82 |
+
|
83 |
+
from flax_models import load_metric_from_model
|
84 |
+
|
85 |
+
# Example
|
86 |
+
# `load_metric_from_model` returns directly the metric tensor function
|
87 |
+
metric_fn = load_metric_from_model("/your_path_to_model_folder/kerr/boyer_lindquist/zackiger")
|
88 |
+
|
89 |
+
# Now is ready to be used.
|
90 |
+
```
|
91 |
+
|
92 |
+
## Citation
|
93 |
+
|
94 |
+
**Paper**: https://arxiv.org/abs/2507.11589
|
95 |
+
|
96 |
+
```
|
97 |
+
@article{
|
98 |
+
title={EINSTEIN FIELDS: A NEURAL PERSPECTIVE TO COMPUTATIONAL GENERAL RELATIVITY},
|
99 |
+
author={Cranganore, Bodnar and Berzins},
|
100 |
+
year={2025},
|
101 |
+
eprint={2507.11589},
|
102 |
+
archivePrefix={arXiv},
|
103 |
+
primaryClass={cs.LG}
|
104 |
+
}
|
105 |
+
```
|
106 |
+
|