Push model using huggingface_hub.
Browse files- README.md +12 -155
- config.json +11 -0
- model.safetensors +3 -0
README.md
CHANGED
|
@@ -1,155 +1,12 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
Install related packages:
|
| 15 |
-
|
| 16 |
-
```bash
|
| 17 |
-
pip install torch==1.12.1+cu116 torchvision==0.13.1+cu116 -f https://download.pytorch.org/whl/torch_stable.html
|
| 18 |
-
pip install -r requirements.txt
|
| 19 |
-
```
|
| 20 |
-
|
| 21 |
-
## Data Preparation
|
| 22 |
-
|
| 23 |
-
There are three radar reflectivity datasets being evaluated with **STLDM** and other baselines: SEVIR, HKO-7, and MeteoNet.
|
| 24 |
-
|
| 25 |
-
### SEVIR
|
| 26 |
-
|
| 27 |
-
For the SEVIR dataset, please refer to [https://github.com/amazon-science/earth-forecasting-transformer](https://github.com/amazon-science/earth-forecasting-transformer) for downloading the SEVIR dataset. Please make sure the downloaded files are stored in the following way:
|
| 28 |
-
|
| 29 |
-
```
|
| 30 |
-
data/
|
| 31 |
-
ββ SEVIR/
|
| 32 |
-
β ββ data/
|
| 33 |
-
β β ββ vil/
|
| 34 |
-
| | ββ 2017/
|
| 35 |
-
| | ββ 2018/
|
| 36 |
-
| | ββ 2019/
|
| 37 |
-
β ββ CATALOG.csv
|
| 38 |
-
ββ ...
|
| 39 |
-
```
|
| 40 |
-
|
| 41 |
-
### HKO-7
|
| 42 |
-
|
| 43 |
-
For the HKO-7 dataset, please refer to [https://github.com/sxjscience/HKO-7](https://github.com/sxjscience/HKO-7) for downloading the HKO-7 dataset. Please make sure the downloaded files are stored in the following way:
|
| 44 |
-
|
| 45 |
-
```
|
| 46 |
-
data/
|
| 47 |
-
ββ HKO-7/
|
| 48 |
-
β ββ hko_data/
|
| 49 |
-
β β ββ mask_dat.npz
|
| 50 |
-
β ββ radarPNG/
|
| 51 |
-
β β ββ 2009/
|
| 52 |
-
β β ββ ...
|
| 53 |
-
β ββ radarPNG_mask/
|
| 54 |
-
β β ββ 2009/
|
| 55 |
-
β β ββ ...
|
| 56 |
-
β ββ samplers/
|
| 57 |
-
ββ ...
|
| 58 |
-
```
|
| 59 |
-
|
| 60 |
-
The samplers files have been saved inside ```data/HKO-7/samplers/``` for you.
|
| 61 |
-
|
| 62 |
-
### MeteoNet
|
| 63 |
-
|
| 64 |
-
For the MeteoNet dataset, please refer to [https://github.com/DeminYu98/DiffCast](https://github.com/DeminYu98/DiffCast) to download the pre-processed h5 file, or you can follow the provided instruction to pre-process the raw dataset found on [the official MeteoNet website](https://meteofrance.github.io/meteonet/english/data/rain-radar/). Please make sure the file is named as ```meteo.h5``` and stored in the following way:
|
| 65 |
-
|
| 66 |
-
```
|
| 67 |
-
data/
|
| 68 |
-
ββ meteonet/
|
| 69 |
-
β ββ meteo.h5
|
| 70 |
-
ββ ...
|
| 71 |
-
```
|
| 72 |
-
|
| 73 |
-
### FYI π‘
|
| 74 |
-
|
| 75 |
-
If you really want to change the suggested way to save those data files above, remember to update the corresponding file directories as well in the following ways:
|
| 76 |
-
|
| 77 |
-
- The SEVIR dataset: ```SEVIR_ROOT_DIR``` in ```data/dutils.py```
|
| 78 |
-
- The HKO-7 dataset: ```__C.ROOT_DIR```, ```possible_hko_png_paths``` and ```possible_hko_mask_paths``` in ```nowcasting/config.py```
|
| 79 |
-
- The MeteoNet dataset: ```METEO_FILE_DIR``` in ```data/dutils.py```
|
| 80 |
-
|
| 81 |
-
## Training
|
| 82 |
-
|
| 83 |
-
You can train the **STLDM** with the script ```train.py``` with the following command:
|
| 84 |
-
|
| 85 |
-
``` bash
|
| 86 |
-
python train.py -d HKO7_5_20 --seq_len 5 --out_len 20 -m STLDM_HKO --type "3D"
|
| 87 |
-
```
|
| 88 |
-
|
| 89 |
-
In particular, there are a few arguments to set:
|
| 90 |
-
|
| 91 |
-
- ```-d``` / ```--dataset``` : The dataset config found in ```data/config.py```. Please set the corresponding ```--seq_len``` (input sequence length) and ```--out_len``` (output sequence length) as well.
|
| 92 |
-
- ```-m``` / ```--model``` : The STLDM config found in ```stldm/__init__.py```
|
| 93 |
-
- ```--type```: is to specify whether is ```"3D"``` (**Spatiotemporal**) or ```"2S"``` (**Spatial**) Visual Enhancement.
|
| 94 |
-
|
| 95 |
-
## Evaluation and Sampling
|
| 96 |
-
|
| 97 |
-
### Evaluation
|
| 98 |
-
|
| 99 |
-
For the evaluation of **STLDM**, we generate ten ensemble predictions of **STLDM** and evaluate them.
|
| 100 |
-
|
| 101 |
-
First, let's run the ensemble generation script, ```ens_gen.py``` to generate the ensemble prediction and save it as an npy file, with the following command:
|
| 102 |
-
|
| 103 |
-
```bash
|
| 104 |
-
python ens_gen.py -d HKO7_5_20 -m STLDM_HKO --type "3D" -f "model_checkpoint" --c_str 1.0 --e_id 0
|
| 105 |
-
```
|
| 106 |
-
|
| 107 |
-
Other than the arguments above, there are stll a few parameters to set:
|
| 108 |
-
|
| 109 |
-
- ```-f```: the relative/absolute path to **STLDM** checkpoint
|
| 110 |
-
- ```--c_str```: Classifier-Free Guidance strength, it is disabled when set to 0.0
|
| 111 |
-
- ```--e_id```: Represent the $e\_id$ th ensemble prediction, starting from 0
|
| 112 |
-
|
| 113 |
-
Then, we run the evaluation script, ```ens_eval.py``` to evaluate the generated ensemble predictions (labeled starting from 0) with the following command:
|
| 114 |
-
|
| 115 |
-
```bash
|
| 116 |
-
python ens_eval.py -d HKO7_5_20 --out_len 20 --e_file "filepath_{}.npy" --ens_no 10
|
| 117 |
-
```
|
| 118 |
-
|
| 119 |
-
Again, other than the arguments specified above, there are still a few parameters to set:
|
| 120 |
-
|
| 121 |
-
- ```--e_file```: The format of the ensemble predictions, replace the $e\_id$ by $\{ \}$. Make sure the predictions are labelled, starting from 0.
|
| 122 |
-
- ```--ens_no```: Total number of ensemble predictions, i.e., 10
|
| 123 |
-
|
| 124 |
-
### Sampling
|
| 125 |
-
|
| 126 |
-
Other than the evaluation process, we also provide a demo file, ```demo.ipynb``` to show you how to set up and call the **STLDM$** to generate samples for your side implementation. In this demo, we include three different configurations:
|
| 127 |
-
|
| 128 |
-
- **SpatioTemporal** Visual Enhancement with image size of *128*
|
| 129 |
-
- **Spatial** Visual Enhancement with image size of *128*
|
| 130 |
-
- **SpatioTemporal** Visual Enhancement with image size of *256*
|
| 131 |
-
|
| 132 |
-
You can download their corresponding modek checkpoints from [this link](https://hkustconnect-my.sharepoint.com/:f:/g/personal/sqfoo_connect_ust_hk/IgATefXlByydRaKlqYnC3hIyAUNk5ftNZBXJz0yKa7d89yE?e=BLk0V3) ([Alternative link](https://drive.google.com/drive/folders/1bCQBt5JPQ-JzHSy8ruYhj6p32Q5uEECM?usp=sharing)).
|
| 133 |
-
|
| 134 |
-
## Credits and Acknowledgment
|
| 135 |
-
|
| 136 |
-
We would like to thank these developers and credit their code.
|
| 137 |
-
|
| 138 |
-
- [FACL](https://github.com/argenycw/FACL)
|
| 139 |
-
- [OpenSTL](https://github.com/chengtan9907/OpenSTL/blob/OpenSTL-Lightning/README.md)
|
| 140 |
-
- [DiffCast](https://github.com/DeminYu98/DiffCast)
|
| 141 |
-
- [denoising_diffusion_pytorch](https://github.com/lucidrains/denoising-diffusion-pytorch/tree/main/denoising_diffusion_pytorch)
|
| 142 |
-
|
| 143 |
-
## Citation
|
| 144 |
-
|
| 145 |
-
If you find this work helpful, please cite the following:
|
| 146 |
-
|
| 147 |
-
```bib
|
| 148 |
-
@article{foo2025stldm,
|
| 149 |
-
author = {Foo, Shi Quan and Wong, Chi-Ho and Gao, Zhihan and Yeung, Dit-Yan and Wong, Ka-Hing and Wong, Wai-Kin},
|
| 150 |
-
title = {STLDM: Spatio-Temporal Latent Diffusion Model for Precipitation Nowcasting},
|
| 151 |
-
journal = {Transactions on Machine Learning Research},
|
| 152 |
-
year = {2025},
|
| 153 |
-
url = {https://openreview.net/forum?id=f4oJwXn3qg},
|
| 154 |
-
}
|
| 155 |
-
```
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
pipeline_tag: Precipitation_Nowcasting
|
| 4 |
+
tags:
|
| 5 |
+
- model_hub_mixin
|
| 6 |
+
- pytorch_model_hub_mixin
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration:
|
| 10 |
+
- Code: https://github.com/sqfoo/stldm_official
|
| 11 |
+
- Paper: [More Information Needed]
|
| 12 |
+
- Docs: [More Information Needed]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"beta_schedule": "sigmoid",
|
| 3 |
+
"ddim_sampling_eta": 0.0,
|
| 4 |
+
"min_snr_gamma": 5,
|
| 5 |
+
"min_snr_loss_weight": false,
|
| 6 |
+
"objective": "pred_v",
|
| 7 |
+
"offset_noise_strength": 0.0,
|
| 8 |
+
"sampling_timesteps": 20,
|
| 9 |
+
"schedule_fn_kwargs": {},
|
| 10 |
+
"timesteps": 50
|
| 11 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ed003bc16f59ac7f88ea5b81de8809b0ad28ceb4b0f8bd28c47907e958eafbbd
|
| 3 |
+
size 324054852
|