-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Example] Add STAFNet Model for Air Quality Prediction #982
base: develop
Are you sure you want to change the base?
Conversation
Thanks for your contribution! |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hydra: | ||
run: | ||
# dynamic output directory according to running time and override name | ||
dir: outputs_chip_heat/${now:%Y-%m-%d}/${now:%H-%M-%S}/${hydra.job.override_dirname} | ||
job: | ||
name: ${mode} # name of logfile | ||
chdir: false # keep current working directory unchanged | ||
config: | ||
override_dirname: | ||
exclude_keys: | ||
- TRAIN.checkpoint_path | ||
- TRAIN.pretrained_model_path | ||
- EVAL.pretrained_model_path | ||
- mode | ||
- output_dir | ||
- log_freq | ||
callbacks: | ||
init_callback: | ||
_target_: ppsci.utils.callbacks.InitCallback | ||
sweep: | ||
# output directory for multirun | ||
dir: ${hydra.run.dir} | ||
subdir: ./ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hydra: | |
run: | |
# dynamic output directory according to running time and override name | |
dir: outputs_chip_heat/${now:%Y-%m-%d}/${now:%H-%M-%S}/${hydra.job.override_dirname} | |
job: | |
name: ${mode} # name of logfile | |
chdir: false # keep current working directory unchanged | |
config: | |
override_dirname: | |
exclude_keys: | |
- TRAIN.checkpoint_path | |
- TRAIN.pretrained_model_path | |
- EVAL.pretrained_model_path | |
- mode | |
- output_dir | |
- log_freq | |
callbacks: | |
init_callback: | |
_target_: ppsci.utils.callbacks.InitCallback | |
sweep: | |
# output directory for multirun | |
dir: ${hydra.run.dir} | |
subdir: ./ | |
defaults: | |
- ppsci_default | |
- TRAIN: train_default | |
- TRAIN/ema: ema_default | |
- TRAIN/swa: swa_default | |
- EVAL: eval_default | |
- INFER: infer_default | |
- hydra/job/config/override_dirname/exclude_keys: exclude_keys_default | |
- _self_ | |
hydra: | |
run: | |
# dynamic output directory according to running time and override name | |
dir: outputs_chip_heat/${now:%Y-%m-%d}/${now:%H-%M-%S}/${hydra.job.override_dirname} | |
job: | |
name: ${mode} # name of logfile | |
chdir: false # keep current working directory unchanged | |
callbacks: | |
init_callback: | |
_target_: ppsci.utils.callbacks.InitCallback | |
sweep: | |
# output directory for multirun | |
dir: ${hydra.run.dir} | |
subdir: ./ |
hydra: | ||
run: | ||
# dynamic output directory according to running time and override name | ||
dir: outputs_chip_heat/${now:%Y-%m-%d}/${now:%H-%M-%S}/${hydra.job.override_dirname} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dir: 后面的名字改成正确的名字
output_dir: ${hydra:run.dir} | ||
log_freq: 20 | ||
|
||
STAFNet_DATA_PATH: "/data4/home/hyin/workspace/SATFNet/data/2020-2023_new/train_data.pkl" # |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用相对路径
@@ -0,0 +1,1029 @@ | |||
# STAFNet | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文档开头请加上模型训练和评估命令,参考
PaddleScience/docs/zh/examples/allen_cahn.md
Lines 1 to 23 in 5d710f6
# Allen-Cahn | |
<a href="https://aistudio.baidu.com/projectdetail/7927786" class="md-button md-button--primary" style>AI Studio快速体验</a> | |
=== "模型训练命令" | |
``` sh | |
# linux | |
wget -nc https://paddle-org.bj.bcebos.com/paddlescience/datasets/AllenCahn/allen_cahn.mat -P ./dataset/ | |
# windows | |
# curl https://paddle-org.bj.bcebos.com/paddlescience/datasets/AllenCahn/allen_cahn.mat --create-dirs -o ./dataset/allen_cahn.mat | |
python allen_cahn_piratenet.py | |
``` | |
=== "模型评估命令" | |
``` sh | |
# linux | |
wget -nc https://paddle-org.bj.bcebos.com/paddlescience/datasets/AllenCahn/allen_cahn.mat -P ./dataset/ | |
# windows | |
# curl https://paddle-org.bj.bcebos.com/paddlescience/datasets/AllenCahn/allen_cahn.mat --create-dirs -o ./dataset/allen_cahn.mat | |
python allen_cahn_piratenet.py mode=eval EVAL.pretrained_model_path=https://paddle-org.bj.bcebos.com/paddlescience/models/AllenCahn/allen_cahn_piratenet_pretrained.pdparams | |
``` |
|
||
模型的总体结构如图所示: | ||
|
||
![image-20240530165151443](C:\Users\pal\AppData\Roaming\Typora\typora-user-images\image-20240530165151443.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请将图片上传到本PR
|
||
STAFNet 包含三个模块,分别将空间信息、气象信息和历史信息融合到空气质量特征表征中。首先模型的输入:过去T个时刻的**空气质量**数据和**气象**数据,使用两个空间感知 GNN(SAGNN),利用监测站之间的空间关系分别提取空气质量和气象信息。然后,跨图融合注意(CGF)将气象信息融合到空气质量表征中。最后,我们采用 TimesNet 模型来描述空气质量序列的时间动态,并生成多步骤预测。这一推理过程可表述如下, | ||
|
||
![image-20240531173333183](C:\Users\pal\AppData\Roaming\Typora\typora-user-images\image-20240531173333183.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请将图片上传到本PR
|
||
所有空气质量和气象观测数据每小时记录一次。数据集的收集时间为 2021 年 1 月 24 日至 2023 年 1 月 19 日,按 9:1的比例将数据分为训练集和测试集。空气质量观测数据来自国家城市空气质量实时发布平台,气象观测数据来自中国气象局。数据集的具体细节如下表所示, | ||
|
||
<div> <!--块级封装--> <center> <!--将图片和文字居中--> <img src="C:\Users\pal\AppData\Roaming\Typora\typora-user-images\image-20240530104042194.png" alt="image-20240530104042194" style="zoom: 25%;" /> <br> <!--换行--> 北京空气质量数据集 <!--标题--> </center> </div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请将图片上传到本PR
|
||
数据加载代码如下: | ||
|
||
```python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
代码块请使用引用语法,参考
PaddleScience/docs/zh/examples/allen_cahn.md
Lines 136 to 142 in 5d710f6
``` py linenums="94" | |
--8<-- | |
examples/allen_cahn/allen_cahn_piratenet.py:94:110 | |
--8<-- | |
``` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
训练日志可以不用上传,需要上传的是训练完成保存下来的模型参数
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同理,不用上传
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同理,不用上传
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请不要修改或删除已有代码,建议将当前代码与上游代码进行合并,再提交代码
PR types
PR changes
Describe