Model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: pytorch
|
| 3 |
+
tags:
|
| 4 |
+
- topology-optimization
|
| 5 |
+
- structural-optimization
|
| 6 |
+
- flow-matching
|
| 7 |
+
- diffusion-transformer
|
| 8 |
+
- pytorch_model_hub_mixin
|
| 9 |
+
- model_hub_mixin
|
| 10 |
+
datasets:
|
| 11 |
+
- OpenTO/OpenTO
|
| 12 |
+
pipeline_tag: image-to-image
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# TopoDiT — Optimize Any Topology 2
|
| 16 |
+
|
| 17 |
+
TopoDiT is the generative model of **Optimize Any Topology 2 (OAT2)**: a 688.6M-parameter
|
| 18 |
+
conditional diffusion transformer, trained with flow matching, that generates
|
| 19 |
+
minimum-compliance structural topologies in the latent space of the frozen
|
| 20 |
+
[OpenTO/NFAE](https://huggingface.co/OpenTO/NFAE) neural-field autoencoder. It is the
|
| 21 |
+
successor of the latent-diffusion U-Net of
|
| 22 |
+
[Optimize Any Topology](https://arxiv.org/abs/2510.23667) (NeurIPS 2025) and takes the
|
| 23 |
+
same inputs: domain shape, mesh cell size, target volume fraction, boundary conditions
|
| 24 |
+
and loads — at any resolution and aspect ratio.
|
| 25 |
+
|
| 26 |
+
**Code:** the `OptimizeAnyTopology2` repository (training, evaluation, GPU FEM).
|
| 27 |
+
|
| 28 |
+
## Results (OpenTO test split, 5,000 problems, zero-shot, no CFG)
|
| 29 |
+
|
| 30 |
+
| | OAT (2025) | **TopoDiT / OAT2** |
|
| 31 |
+
|---|---|---|
|
| 32 |
+
| failure rate, 1 sample | 40.0% | **21.8%** |
|
| 33 |
+
| median compliance error, 1 sample | 3.94% | **0.46%** |
|
| 34 |
+
| failure rate, best of 4 | 25.2% | **11.6%** |
|
| 35 |
+
| median compliance error, best of 4 | 2.86% | **0.18%** |
|
| 36 |
+
| failure rate, best of 4 + 10 PGD steps | 14.9% | **5.8%** |
|
| 37 |
+
|
| 38 |
+
Identical FEM and statistics for both rows (CE = (C − C_gt)/C_gt; failure = CE ≥ 100%).
|
| 39 |
+
|
| 40 |
+
## Architecture
|
| 41 |
+
|
| 42 |
+
- Dense DiT over the 64×64×1 NFAE latent: patch size 4 → 256 tokens, 24 blocks,
|
| 43 |
+
width 1152, 16 heads; predicts the flow-matching velocity.
|
| 44 |
+
- Global conditions (shape, cell size, volume fraction) → one vector concatenated with
|
| 45 |
+
the timestep embedding into adaLN-Zero modulation. Boundary conditions and loads →
|
| 46 |
+
attention-pooled spatial tokens (32-cell grid over the domain, every point kept),
|
| 47 |
+
read by cross-attention in every block. Continuous rectangle position embeddings,
|
| 48 |
+
QK-normalized attention.
|
| 49 |
+
- Condition encoder: 4 layers, width 1152, 12 heads, token width 768.
|
| 50 |
+
|
| 51 |
+
## Training
|
| 52 |
+
|
| 53 |
+
OpenTO `labeled` + `NITO` (894k optimized structures), 50 epochs, 349,200 steps at
|
| 54 |
+
effective batch 128, AdamW lr 1e-4 (cosine to 1e-6, 1k warm-up), weight decay 1e-4,
|
| 55 |
+
logit-normal timesteps, classifier-free-guidance dropout per condition. Latent
|
| 56 |
+
normalization statistics are stored on the model.
|
| 57 |
+
|
| 58 |
+
## Usage
|
| 59 |
+
|
| 60 |
+
```python
|
| 61 |
+
import torch
|
| 62 |
+
from datasets import load_dataset
|
| 63 |
+
from OAT import NFAE, TopoDiT
|
| 64 |
+
from OAT.DataUtils import OpenTO, DiffusionCollator, cached_full_grid_cell
|
| 65 |
+
from OAT.Pipelines import FlowMatchPipeline
|
| 66 |
+
|
| 67 |
+
device = 'cuda'
|
| 68 |
+
model = TopoDiT.from_pretrained('OpenTO/TopoDiT').to(device).eval()
|
| 69 |
+
nfae = NFAE.from_pretrained('OpenTO/NFAE').to(device).eval()
|
| 70 |
+
|
| 71 |
+
data = load_dataset('OpenTO/OpenTO', split='test')
|
| 72 |
+
ds = OpenTO(data, mode='diffusion', train=False)
|
| 73 |
+
batch = DiffusionCollator()([ds[0]]).to(device)
|
| 74 |
+
pipe = FlowMatchPipeline(shift=1.0)
|
| 75 |
+
|
| 76 |
+
with torch.no_grad(), torch.autocast('cuda', torch.bfloat16):
|
| 77 |
+
z = pipe.inference(model, batch, num_sampling_steps=20, guidance_scale=1.0)
|
| 78 |
+
phi = nfae.decoder(model.denormalize(z.float()))
|
| 79 |
+
w, h = data[0]['topology'].size
|
| 80 |
+
coord, cell = cached_full_grid_cell(h, w)
|
| 81 |
+
density = nfae.renderer(phi, [coord[None].to(device)], [cell[None].to(device)])[0][0, 0]
|
| 82 |
+
topology = density.float().cpu().numpy() > 0.5
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
Recommended sampling: 20 Euler steps, `guidance_scale=1.0` (CFG off); 5–10 steps are
|
| 86 |
+
equally good zero-shot.
|
| 87 |
+
|
| 88 |
+
## Citation
|
| 89 |
+
|
| 90 |
+
```bibtex
|
| 91 |
+
@inproceedings{nobari2025oat,
|
| 92 |
+
title = {Optimize Any Topology: A Foundation Model for Shape- and Resolution-Free Structural Topology Optimization},
|
| 93 |
+
author = {Heyrani Nobari, Amin and Regenwetter, Lyle and Picard, Cyril and Han, Ligong and Ahmed, Faez},
|
| 94 |
+
booktitle = {Advances in Neural Information Processing Systems (NeurIPS)},
|
| 95 |
+
year = {2025},
|
| 96 |
+
note = {arXiv:2510.23667}
|
| 97 |
+
}
|
| 98 |
+
```
|