Skip to main content

Spatial-temporal Fourier Transformer

Project description

StFT

Spatio-temporal Fourier Transformer for Long-term Dynamics Prediction

Spatio-temporal Fourier Transformer architecture

Overview

StFT is a multi-scale spatiotemporal forecasting model for long-horizon dynamics prediction.
This repository provides training code for plasma MHD data and core model components.

Repository Structure

  • train.py — training entrypoint
  • StFT_3D.py — StFT model definition
  • data_utils.py — dataset/loss/grid utilities
  • model_utils.py — Transformer layers and positional embeddings

Installation

git clone https://github.com/BerkeleyLab/StFT.git
cd StFT

Install dependencies:

pip install -r requirements.txt

GPU note: On CUDA systems, install a CUDA-compatible PyTorch build first using the official PyTorch instructions.

Training StFT

To train StFT on the plasma MHD dataset:

python train.py

By default, the results will be saved to the ~/ray_results at home directory.
To customize the saved directory, you can change the save_path variable in the train.py file.

Example Results

Autoregressive error over time
Mean relative L2 error across autoregressive rollout timesteps.


Qualitative comparison
Qualitative long-horizon error comparison across autoregressive baselines.

References

@article{stft2026,
  title={St{FT}: Spatio-temporal Fourier Transformer for Long-term Dynamics Prediction},
  author={Long, Da and Zhe, Shandian and Williams, Samuel and Oliker, Leonid and Bai, Zhe},
  journal={Transactions on Machine Learning Research},
  issn={2835-8856},
  year={2026},
  url={https://openreview.net/forum?id=o9Cb0ri2oW},
}

See the LICENSE file for copyright and licensing information.


- Copyright Notice -

Spatio-temporal Fourier Transformer for Long-term Dynamics Prediction (StFT) Copyright (c) 2025, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.

If you have questions about your rights to use or distribute this software, please contact Berkeley Lab's Intellectual Property Office at IPO@lbl.gov.

NOTICE. This Software was developed under funding from the U.S. Department of Energy and the U.S. Government consequently retains certain rights. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, distribute copies to the public, prepare derivative works, and perform publicly and display publicly, and to permit others to do so.

Questions? Contact Zhe Bai (zhebai@lbl.gov)


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stft_transformer-0.1.10.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stft_transformer-0.1.10-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file stft_transformer-0.1.10.tar.gz.

File metadata

  • Download URL: stft_transformer-0.1.10.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for stft_transformer-0.1.10.tar.gz
Algorithm Hash digest
SHA256 c8c29b6567e20be6c7adf273bb4f5f8a3528c9abd86b71e1c3a59f907c4caf54
MD5 59bf33e8232c04737798d227a56bddfd
BLAKE2b-256 cac850ea04fdadf1928075919214bb2baf227cb20fab1f990a29d3c5aeca4612

See more details on using hashes here.

Provenance

The following attestation bundles were made for stft_transformer-0.1.10.tar.gz:

Publisher: publish.yml on BerkeleyLab/StFT

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stft_transformer-0.1.10-py3-none-any.whl.

File metadata

File hashes

Hashes for stft_transformer-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 a8496c2b7efbcbf89fafb39084bf1b46c05d32e0e0035ff7d4e3bae718d47b60
MD5 500f3571cf35397718e67d8d59b9c200
BLAKE2b-256 978d5710d00464aba67e725701c2e54619fd56fb66b397e49693d5d9c20901a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for stft_transformer-0.1.10-py3-none-any.whl:

Publisher: publish.yml on BerkeleyLab/StFT

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page