Giter Site home page Giter Site logo

baratilab / cafa Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 10.18 MB

ForeCasting with Factorized Attention (CaFA), a computationally efficient Transformer-based weather prediction model

License: MIT License

Python 69.30% Shell 0.12% Jupyter Notebook 30.59%

cafa's Introduction

CaFA

Code for ForeCasting with Factorized Attention (CaFA) arxiv

1. Environment

We provided a yaml file for the conda environment used for this project.

conda env create -f environment.yml

2. Data

The ERA5 reanalysis data courtesy is under Copernicus Climate Data Store. WeatherBench2 provides processed version of it with different resolutions (in .zarr format).
Data and normalization statistics in .npy format that is used in this project are provided below, which is derived from WeatherBench2's dataset.

Resolution Train range Validation range link
240 x 121 1979-2018 2019 link
64 x 32 1979-2015 2016 link

(Note that the final model on 240 x 121 is trained with year 2019 in training data.)

3. Training

The configuration for training are provided under configs directory. Training a 100M parameter CaFA on 64 x 32 resolution will take around 15 hr for stage 1 and 50 hr for stage 2 on a 3090.

Stage 1 training example (on 64 x 32 resolution):

bash run_stage1.sh

Stage 2 fine tuning example (on 64 x 32 resolution):

bash run_stage2.sh

The pre-trained checkpoints can be downloaded through belowing links

Resolution Train range # of Parameter link
240 x 121 1979-2019 ~200M link
64 x 32 1979-2015 ~100M link

4. Inference

To run model inference on processed npy files, please refer to validate_loop() function under dynamics_training_loop.py.

Here we povide a demo ipynb to showcase how to run the model on weatherbench2's data, check: inference_demo.ipynb.

Acknowledgement

The ERA data used in the project is from European Centre for Medium-Range Weather Forecasts. WeatherBench2 has provided processed and aggregated versions, which is publicly available at link.

The spherical harmonics implementation is taken from se3_transformer_pytorch/spherical_harmonics.py.

Reference

If you find this project useful, please kindly consider citing our work:

@misc{li2024cafa,
      title={CaFA: Global Weather Forecasting with Factorized Attention on Sphere}, 
      author={Zijie Li and Anthony Zhou and Saurabh Patil and Amir Barati Farimani},
      year={2024},
      eprint={2405.07395},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}

cafa's People

Contributors

zijieli-jlee avatar

Watchers

 avatar  avatar Peter Pak avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.