-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
【hydra No.18】Adapt DeepCFD to hydra #583
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.
辛苦大佬再修改一下
docs/zh/examples/deepcfd.md
Outdated
``` sh | ||
# linux | ||
wget wget -P ./datasets/ https://paddle-org.bj.bcebos.com/paddlescience/datasets/DeepCFD/dataX.pkl | ||
wget wget -P ./datasets/ https://paddle-org.bj.bcebos.com/paddlescience/datasets/DeepCFD/dataY.pkl | ||
# windows | ||
# curl wget -P ./datasets/ https://paddle-org.bj.bcebos.com/paddlescience/datasets/DeepCFD/dataX.pkl --output dataX.pkl | ||
# curl wget -P ./datasets/ https://paddle-org.bj.bcebos.com/paddlescience/datasets/DeepCFD/dataY.pkl --output dataY.pkl | ||
python deepcfd.py | ||
``` |
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.
``` sh | |
# linux | |
wget wget -P ./datasets/ https://paddle-org.bj.bcebos.com/paddlescience/datasets/DeepCFD/dataX.pkl | |
wget wget -P ./datasets/ https://paddle-org.bj.bcebos.com/paddlescience/datasets/DeepCFD/dataY.pkl | |
# windows | |
# curl wget -P ./datasets/ https://paddle-org.bj.bcebos.com/paddlescience/datasets/DeepCFD/dataX.pkl --output dataX.pkl | |
# curl wget -P ./datasets/ https://paddle-org.bj.bcebos.com/paddlescience/datasets/DeepCFD/dataY.pkl --output dataY.pkl | |
python deepcfd.py | |
``` | |
``` sh | |
# linux | |
wget -P ./datasets/ https://paddle-org.bj.bcebos.com/paddlescience/datasets/DeepCFD/dataX.pkl | |
wget -P ./datasets/ https://paddle-org.bj.bcebos.com/paddlescience/datasets/DeepCFD/dataY.pkl | |
# windows | |
# curl -o ./datasets/dataX.pkl https://paddle-org.bj.bcebos.com/paddlescience/datasets/DeepCFD/dataX.pkl | |
# curl -o ./datasets/dataX.pkl https://paddle-org.bj.bcebos.com/paddlescience/datasets/DeepCFD/dataY.pkl | |
python deepcfd.py | |
``` |
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.
Done.
docs/zh/examples/deepcfd.md
Outdated
``` py linenums="47" title="examples/deepcfd/conf/deepcfd.yaml" | ||
--8<-- | ||
examples/deepcfd/deepcfd.py:298:301 | ||
examples/deepcfd/conf/deepcfd.yaml:47:51 | ||
--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.
==> ``` yaml
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.
Done.
docs/zh/examples/deepcfd.md
Outdated
--8<-- | ||
``` | ||
|
||
### 3.5 优化器构建 | ||
训练过程会调用优化器来更新模型参数,此处选择较为常用的 `Adam` 优化器,学习率设置为 0.001。 | ||
训练过程会调用优化器来更新模型参数,此处选择较为常用的 `Adam` 优化器,学习率设置为 0.001,权值衰减设置为 0.005。 |
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.
Done.
examples/deepcfd/conf/deepcfd.yaml
Outdated
|
||
# model settings | ||
MODEL: | ||
unetex: |
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.
unetex这个字段可以删除,单模型的情况下,参数直接放到MODEL:字段下即可
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.
好的
examples/deepcfd/deepcfd.py
Outdated
# set random seed for reproducibility | ||
ppsci.utils.misc.set_random_seed(cfg.seed) | ||
# initialize logger | ||
logger.init_logger("ppsci", os.path.join(cfg.output_dir, "train.log"), "info") |
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.
==> eval.log
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.
Done.
examples/deepcfd/deepcfd.py
Outdated
CHANNEL_SIZE = 3 | ||
X_SIZE = 172 | ||
Y_SIZE = 79 | ||
model = ppsci.arch.UNetEx("input", "output", **cfg.MODEL.unetex) |
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.
input和output也可以放到配置文件里
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.
Done.
examples/deepcfd/deepcfd.py
Outdated
test_x, test_y = test_dataset | ||
|
||
# initialize model | ||
model = ppsci.arch.UNetEx("input", "output", **cfg.MODEL.unetex) |
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.
Done.
examples/deepcfd/deepcfd.py
Outdated
# evaluate | ||
solver.eval() | ||
|
||
PLOT_DIR = os.path.join(cfg.output_dir, "visual") | ||
os.makedirs(PLOT_DIR, exist_ok=True) | ||
VISU_INDEX = 0 |
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.
VISU_INDEX这个变量可以删掉,因为没有第二个使用它的地方
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.
其他没什么问题了,辛苦大佬修改,顺便麻烦合一下最新的develop分支,里面解决了ldc2d_steady在CI上挂掉的问题
optimizer = ppsci.optimizer.Adam(LEARNING_RATE, weight_decay=WEIGHT_DECAY)(model) | ||
optimizer = ppsci.optimizer.Adam( | ||
cfg.TRAIN.learning_rate, weight_decay=cfg.TRAIN.weight_decay | ||
)(model) | ||
|
||
# manually build validator | ||
eval_dataloader_cfg = { |
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.
train函数里的eval_dataloader_cfg的batchsize改成cfg里的参数
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.
好的,辛苦大佬 review
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.
LGTM
* adapt DeepCFD to hydra * fix * fix * fix * fix
PR types
Others
PR changes
Others
Describe
DeepCFD 案例代码重构,添加评估函数 evaluate,及其训练命令。