Skip to main content

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

Release files for pytorchfire 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytorchfire 1.1.1
File Size Uploaded
pytorchfire-1.1.1.tar.gz 183.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytorchfire 1.1.1
File Interpreter ABI Platform
pytorchfire-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 207.6 kB

Release files / pytorchfire-1.1.1.tar.gz

Download URL pytorchfire-1.1.1.tar.gz
Size 183.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8f267ccf60d8c5c1ab35e3412baadd117edaa0e9bb79da3fa180ec766530f1e9
BLAKE2b-256 checksum
How to use checksums
54a798fd179c71c4fdd83aca79d5decb4e819935d513c0a0c38d608cf9a74e2c
Upload date
Uploaded using Trusted Publishing?
What is 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.3 9 Jun 2026","python":"3.14.6","system":{"name":"Darwin","release":"25.5.0"}} HTTPX2/2.3.0

Release files / pytorchfire-1.1.1-py3-none-any.whl

Download URL pytorchfire-1.1.1-py3-none-any.whl
Size 24.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5bfd0eb852b6d113f7f842387608404d278736c310fdb3b0b18465015345c3dc
BLAKE2b-256 checksum
How to use checksums
d839267203c1a8717d5095707f997804795305709888546eff1bd228d5b968d1
Upload date
Uploaded using Trusted Publishing?
What is 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.3 9 Jun 2026","python":"3.14.6","system":{"name":"Darwin","release":"25.5.0"}} HTTPX2/2.3.0

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page