Skip to main content

PyTorchFire: A GPU-Accelerated Wildfire Simulator with Differentiable Cellular Automata

Project description

PyTorchFire: A GPU-Accelerated Wildfire Simulator with Differentiable Cellular Automata

Hatch project PyPI - Version Read the Docs

Paper doi Paper license

Code DOI Dataset DOI

About The Project

Accurate and rapid prediction of wildfire trends is crucial for effective management and mitigation. However, the stochastic nature of fire propagation poses significant challenges in developing reliable simulators. In this paper, we introduce PyTorchFire, an open-access, PyTorch-based software that leverages GPU acceleration. With our redesigned differentiable wildfire Cellular Automata (CA) model, we achieve millisecond-level computational efficiency, significantly outperforming traditional CPU-based wildfire simulators on real-world-scale fires at high resolution. Real-time parameter calibration is made possible through gradient descent on our model, aligning simulations closely with observed wildfire behavior both temporally and spatially, thereby enhancing the realism of the simulations. Our PyTorchFire simulator, combined with real-world environmental data, demonstrates superior generalizability compared to supervised learning surrogate models. Its ability to predict and calibrate wildfire behavior in real-time ensures accuracy, stability, and efficiency. PyTorchFire has the potential to revolutionize wildfire simulation, serving as a powerful tool for wildfire prediction and management.


🚀 New Companion Tool: FireDataForge

Conference arXiv Paper DOI GitHub Repo Code DOI

Tired of manually downloading and aligning wildfire data? We are excited to introduce FireDataForge, a unified data pipeline that perfectly complements PyTorchFire.

FireDataForge solves the preprocessing bottleneck in wildfire research. Simply provide an MTBS Event ID, and it will automatically retrieve, harmonize, and align 11 distinct data sources (including fire behavior, weather, land cover, elevation, and satellite imagery) into analysis-ready NumPy arrays with embedded metadata.

It is the perfect upstream data provider for your PyTorchFire machine learning models and fire behavior simulations.

📖 Read the Paper:

FireDataForge: A Unified Framework for Multi-Source Wildfire Data Retrieval and Integration > Zeyu Xia, Lexie Chen, Ye Liu, Huilin Huang > Accepted to the 2026 IEEE International Conference on Information Reuse and Integration for Data Science (IEEE IRI 2026). > arXiv:2606.21198 [The official IEEE DOI will be updated here upon release]

👉 Get started with FireDataForge here!


Getting Started

Notebook Examples

Installation

Install with minimal dependencies:

pip install pytorchfire

Install with dependencies for examples:

pip install 'pytorchfire[examples]'

Install together with the FireDataForge data pipeline:

pip install 'pytorchfire[firedataforge]'

Quick Start

To perform wildfire prediction:

from pytorchfire import WildfireModel

model = WildfireModel() # Create a model with default parameters and environment data
model = model.cuda() # Move the model to GPU
# model.reset(seed=seed) # Reset the model with a seed
for _ in range(100): # Run the model for 100 steps
    model.compute() # Compute the next state

To perform parameter calibration:

import torch
from pytorchfire import WildfireModel, BaseTrainer

model = WildfireModel()

trainer = BaseTrainer(model)

trainer.train()
trainer.evaluate()

Run on Real Fires from FireDataForge

Point PyTorchFire straight at a FireDataForge event directory. The harmonized terrain, fuel, wind, and observed-ignition layers are mapped onto a WildfireModel for you — no manual preprocessing:

import torch
from pytorchfire import load_event

# An event folder produced by FireDataForge (output/<MTBS event id>)
event = load_event('output/CA3432611848120191010')

model = event.build_model()   # WildfireModel seeded with the real fire
model = model.to('cuda' if torch.cuda.is_available() else 'cpu')
for _ in range(100):
    model.compute()

# The observed final perimeter ships with the event — use it as a calibration target
target = event.target()       # [H, W] bool tensor

The reader only needs numpy and torch, so you can consume FireDataForge outputs without installing the (heavyweight) firedataforge package itself.

Runnable scripts:

python examples/firedataforge_simulate.py /path/to/output/CA3432611848120191010
python examples/firedataforge_calibration.py /path/to/output/CA3432611848120191010 --device cuda:0

API Documents

See at Our Read the Docs.

Dataset

See at Our Dataset.

Reference

@article{xia2025pytorchfire,
 author = {Zeyu Xia and Sibo Cheng},
 copyright = {CC BY 4.0},
 doi = {10.1016/j.envsoft.2025.106401},
 issn = {1364-8152},
 journal = {Environmental Modelling & Software},
 keywords = {Wildfire simulation, Differentiable Cellular Automata, PyTorch-based software, Parallel computing techniques, GPU-acceleration},
 language = {English},
 month = {4},
 pages = {106401},
 title = {PyTorchFire: A GPU-accelerated wildfire simulator with Differentiable Cellular Automata},
 url = {https://www.sciencedirect.com/science/article/pii/S1364815225000854},
 volume = {188},
 year = {2025}
}

License

MIT License. More information see LICENSE

Contact

Zeyu Xia - zeyu.xia@virginia.edu

Sibo Cheng - sibo.cheng@enpc.fr

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

pytorchfire-1.1.0.tar.gz (184.2 kB view details)

Uploaded Source

Built Distribution

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

pytorchfire-1.1.0-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

Details for the file pytorchfire-1.1.0.tar.gz.

File metadata

  • Download URL: pytorchfire-1.1.0.tar.gz
  • Upload date:
  • Size: 184.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.0 {"ci":null,"cpu":"arm64","distro":{"name":"macOS","version":"26.5.1"},"implementation":{"name":"CPython","version":"3.14.6"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.6.2 7 Apr 2026","python":"3.14.6","system":{"name":"Darwin","release":"25.5.0"}} HTTPX2/2.3.0

File hashes

Hashes for pytorchfire-1.1.0.tar.gz
Algorithm Hash digest
SHA256 a701c09e56c5addb74b748ec63293e153a0be48a7a7842377278e6f92222b14e
MD5 7e57e5da73eecc9a736a7ab57bac02b5
BLAKE2b-256 5ddf933efd1fd3118ce615a5ba4a93a1ec0b75423f04bf1d14687371dae17705

See more details on using hashes here.

File details

Details for the file pytorchfire-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pytorchfire-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.0 {"ci":null,"cpu":"arm64","distro":{"name":"macOS","version":"26.5.1"},"implementation":{"name":"CPython","version":"3.14.6"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.6.2 7 Apr 2026","python":"3.14.6","system":{"name":"Darwin","release":"25.5.0"}} HTTPX2/2.3.0

File hashes

Hashes for pytorchfire-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 157058459459d3b15fcc8cab618582dff5e8e4bdbd87dcce79eb4e086b5aed8b
MD5 61c0a1b90e88129f111ad9f7466804cf
BLAKE2b-256 a7250348f53b7514f657fd5aaab6708ec3d32bb8b13247348c0496145c56bf95

See more details on using hashes here.

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