Update README.md
Browse files
README.md
CHANGED
|
@@ -1,14 +1,3 @@
|
|
| 1 |
-
---
|
| 2 |
-
tags:
|
| 3 |
-
- fourier-neural-operator
|
| 4 |
-
- seismic
|
| 5 |
-
- structural-engineering
|
| 6 |
-
- time-series
|
| 7 |
-
- regression
|
| 8 |
-
- pytorch
|
| 9 |
-
library_name: pytorch
|
| 10 |
-
pipeline_tag: other
|
| 11 |
-
---
|
| 12 |
|
| 13 |
# SeFNO — Seismic Floor Acceleration Response Prediction (FNO v1.0+)
|
| 14 |
|
|
@@ -79,50 +68,7 @@ pip install -r requirement.txt # Windows
|
|
| 79 |
|
| 80 |
### Load a checkpoint and run inference
|
| 81 |
|
| 82 |
-
|
| 83 |
-
import torch
|
| 84 |
-
from neuralop.models import FNO
|
| 85 |
-
|
| 86 |
-
def load_fno(checkpoint_path, n_modes, hidden_channels, n_layers, device="cuda"):
|
| 87 |
-
model = FNO(
|
| 88 |
-
n_modes = (n_modes,),
|
| 89 |
-
hidden_channels = hidden_channels,
|
| 90 |
-
in_channels = 1,
|
| 91 |
-
out_channels = 1,
|
| 92 |
-
n_layers = n_layers,
|
| 93 |
-
projection_channel_ratio = 2,
|
| 94 |
-
domain_padding = 0.1,
|
| 95 |
-
)
|
| 96 |
-
ckpt = torch.load(checkpoint_path, map_location=device, weights_only=False)
|
| 97 |
-
state = ckpt.get("model_state_dict", ckpt)
|
| 98 |
-
# strip torch.compile prefix if present
|
| 99 |
-
state = {(k[10:] if k.startswith("_orig_mod.") else k): v for k, v in state.items()}
|
| 100 |
-
model.load_state_dict(state)
|
| 101 |
-
return model.to(device).eval()
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 105 |
-
|
| 106 |
-
# --- Base model ---
|
| 107 |
-
model = load_fno(
|
| 108 |
-
checkpoint_path = "output/Base-FNO_v1.0+_h64_m64_l4_e50_.../model/fno_best.pth",
|
| 109 |
-
n_modes = 64,
|
| 110 |
-
hidden_channels = 64,
|
| 111 |
-
n_layers = 4,
|
| 112 |
-
device = device,
|
| 113 |
-
)
|
| 114 |
-
|
| 115 |
-
# --- Inference on a single ground motion ---
|
| 116 |
-
import numpy as np
|
| 117 |
-
|
| 118 |
-
gm_array = np.load("my_ground_motion.npy") # shape (3000,), unit m/s²
|
| 119 |
-
x = torch.from_numpy(gm_array).float().unsqueeze(0).unsqueeze(0).to(device) # (1,1,3000)
|
| 120 |
-
|
| 121 |
-
with torch.no_grad():
|
| 122 |
-
pred = model(x).cpu().numpy().squeeze() # shape (3000,)
|
| 123 |
-
|
| 124 |
-
print("Predicted roof acceleration shape:", pred.shape)
|
| 125 |
-
```
|
| 126 |
|
| 127 |
### Quick review notebook
|
| 128 |
|
|
@@ -145,19 +91,6 @@ Open `quick_inference.ipynb` in the cloned repository to run inference on the he
|
|
| 145 |
|
| 146 |
---
|
| 147 |
|
| 148 |
-
## Citation
|
| 149 |
-
|
| 150 |
-
If you use these models, please cite (forthcoming):
|
| 151 |
-
|
| 152 |
-
```
|
| 153 |
-
@misc{jiang2025sefno,
|
| 154 |
-
title = {SeismicFNO: Fourier Neural Operators for Seismic Structural Response Prediction},
|
| 155 |
-
author = {Jason Jiang},
|
| 156 |
-
year = {2025},
|
| 157 |
-
url = {https://github.com/HKUJasonJiang/Seismic-FNO}
|
| 158 |
-
}
|
| 159 |
-
```
|
| 160 |
-
|
| 161 |
## License
|
| 162 |
|
| 163 |
[Creative Commons Attribution 4.0 (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
| 2 |
# SeFNO — Seismic Floor Acceleration Response Prediction (FNO v1.0+)
|
| 3 |
|
|
|
|
| 68 |
|
| 69 |
### Load a checkpoint and run inference
|
| 70 |
|
| 71 |
+
Refer to github repo.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
### Quick review notebook
|
| 74 |
|
|
|
|
| 91 |
|
| 92 |
---
|
| 93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
## License
|
| 95 |
|
| 96 |
[Creative Commons Attribution 4.0 (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/)
|