|
|
--- |
|
|
tags: |
|
|
- model_hub_mixin |
|
|
- pytorch_model_hub_mixin |
|
|
pipeline_tag: image-to-image |
|
|
--- |
|
|
|
|
|
# Optimize Any Topology: A Foundation Model for Shape- and Resolution-Free Structural Topology Optimization |
|
|
|
|
|
This repository contains the official implementation of the **Optimize Any Topology (OAT)** model, a novel foundation-model framework for structural topology optimization. OAT directly predicts minimum-compliance layouts for arbitrary aspect ratios, resolutions, volume fractions, loads, and fixtures, overcoming limitations of prior deep-learning methods. It combines a resolution- and shape-agnostic autoencoder with an implicit neural-field decoder and a conditional latent-diffusion model. |
|
|
|
|
|
OAT was presented in the paper [Optimize Any Topology: A Foundation Model for Shape- and Resolution-Free Structural Topology Optimization](https://huggingface.co/papers/2510.23667) and was accepted to NeurIPS 2025. |
|
|
|
|
|
**Code:** https://github.com/ahnobari/OptimizeAnyTopology |
|
|
|
|
|
<div align="center"> |
|
|
<img src="https://github.com/user-attachments/assets/6200fa2c-0cd5-49af-897c-67688f28c446" alt="OAT Model Demo Image" width="auto"/> |
|
|
</div> |
|
|
|
|
|
This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration. |
|
|
|
|
|
## The Open-TO Dataset |
|
|
The OpenTO dataset, which OAT was trained on, is publicly available on Hugging Face 🤗 at [OpenTO/OpenTO](https://huggingface.co/datasets/OpenTO/OpenTO). It is a new corpus of 2.2 million optimized structures covering 2 million unique boundary-condition configurations. When you run the code, the datasets module is used to automatically download this data. |
|
|
|
|
|
## Pre-Trained Checkpoints |
|
|
Pre-trained checkpoints for both the Neural Field Autoencoder (NFAE) and Latent Diffusion Model (LDM) components of OAT are available on Hugging Face. |
|
|
|
|
|
To load checkpoints using these pretrained weights, you can use the `.from_pretrained` function on both the `NFAE` class and `CTOPUNET` class in the `OAT.Models` module. |
|
|
|
|
|
The checkpoints are available at: |
|
|
- **Auto Encoder:** [OpenTO/NFAE](https://huggingface.co/OpenTO/NFAE) |
|
|
- **Latent Diffusion:** [OpenTO/LDM](https://huggingface.co/OpenTO/LDM) |
|
|
|
|
|
Additionally, two checkpoints trained on a larger latent space (80x80) are available: |
|
|
- **Auto Encoder Large Latent:** [OpenTO/NFAE_L](https://huggingface.co/OpenTO/NFAE_L) |
|
|
- **Latent Diffusion Large Latent:** [OpenTO/LDM_L](https://huggingface.co/OpenTO/LDM_L) |
|
|
|
|
|
## Sample Usage (Generating Solutions) |
|
|
To generate samples, you can run the `GenerateSolutions.py` script provided in the GitHub repository. First, ensure your environment is set up as described in the [GitHub repository](https://github.com/ahnobari/OptimizeAnyTopology#environment). |
|
|
|
|
|
For example, to run generation with 4 samples per problem on the OpenTO test set using 8 GPUs: |
|
|
|
|
|
```bash |
|
|
accelerate launch --config-file ./accelerate_configs/LDM.yml --num-processes=8 -m scripts.GenerateSolutions \ |
|
|
--n_samples 4 \ |
|
|
--splits test\ |
|
|
--output_path GeneratedSamples.pkl \ |
|
|
--guidance_scale 2.0 \ |
|
|
--batch_size 64 \ |
|
|
--num_sampling_steps 20 \ |
|
|
--ddim |
|
|
``` |
|
|
|
|
|
For more detailed instructions on training and evaluation, please refer to the [official GitHub repository](https://github.com/ahnobari/OptimizeAnyTopology). |