-
Notifications
You must be signed in to change notification settings - Fork 204
钙钛矿太阳能电池人工神经网络ppsci实现 #1055
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
base: develop
Are you sure you want to change the base?
钙钛矿太阳能电池人工神经网络ppsci实现 #1055
Conversation
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.
ML_Pipeline文件夹名字建议改一下,如perovskite_solar_cells
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.
该文件已经上传,请将所有相关的路径替换为以下url:
https://paddle-org.bj.bcebos.com/paddlescience/models/PerovskiteSolarCells/solar_cell_pretrained.pdparams
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.
文件名建议改为相关明确的,nn_optuna_ppsci看不出来是什么案例的配置文件
examples/ML_Pipeline/NN.py
Outdated
) | ||
|
||
def create_validator(input_dict, batch_size, name="validator"): | ||
"""创建评估器""" |
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/NN.md
Outdated
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.
文件名建议改为案例相关的名字,比如perovskite_solar_cells
之类的
docs/zh/examples/images/ML/En.png
Outdated
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.
文件名使用小写,并且改成有意义的名字,如overview、pipeline
examples/ML_Pipeline/NN.py
Outdated
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/ML_Pipeline/NN.py
Outdated
"sampler": { | ||
"name": "BatchSampler", | ||
"drop_last": False, | ||
"shuffle": False, | ||
}, |
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.
69-73这个sampler字段在drop_last和shuffle都是false情况下,可以删掉
mode: "train" | ||
seed: 42 | ||
output_dir: "./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.
文件开头建议加上如下的配置:
PaddleScience/examples/allen_cahn/conf/allen_cahn_piratenet.yaml
Lines 1 to 24 in ee2d77c
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_allen_cahn_piratenet/${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: ./ |
eval: | ||
batch_size: 64 | ||
eval_with_no_grad: true | ||
pretrained_model_path: null # 预训练模型路径,可以是本地路径或URL |
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/ML_Pipeline/NN.py
Outdated
print("Starting training...") | ||
ppsci.utils.misc.set_random_seed(cfg.seed) | ||
logger.init_logger("ppsci", osp.join(cfg.output_dir, f"{cfg.mode}.log"), "info") | ||
|
||
if not os.path.exists(cfg.output_dir): | ||
os.makedirs(cfg.output_dir) | ||
|
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.
这里可以删除,配置文件中添加了callback字段后,会自动创建output_dir
examples/ML_Pipeline/NN.py
Outdated
eval_during_train=True, | ||
eval_freq=5, | ||
save_freq=10, | ||
eval_with_no_grad=True, | ||
log_freq=50, |
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中,由yaml控制
examples/ML_Pipeline/NN.py
Outdated
eval_freq=5, | ||
save_freq=10, | ||
eval_with_no_grad=cfg.eval.eval_with_no_grad, | ||
log_freq=50, |
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/ML_Pipeline/NN.py
Outdated
print("Starting evaluation...") | ||
ppsci.utils.misc.set_random_seed(cfg.seed) | ||
logger.init_logger("ppsci", osp.join(cfg.output_dir, f"{cfg.mode}.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.
同上,可删除
|
||
mode: "train" | ||
seed: 42 | ||
output_dir: "./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.
output_dir: "./output" | |
output_dir: ${hydra:run.dir} |
warmup_epoch: 2 | ||
warmup_start_lr: 1.0e-6 |
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.
warmup_epoch: 2 | |
warmup_start_lr: 1.0e-6 | |
warmup_epoch: 2 | |
warmup_start_lr: 1.0e-6 |
gamma=0.95, | ||
decay_steps=5, | ||
warmup_epoch=2, | ||
warmup_start_lr=1.0e-6, |
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.
这里请使用cfg的配置
Thanks for your contribution! |
提交的代码对与本项目无关的代码看起来有所改动,另外没有找到相关的requirement文件,辛苦整理一下代码,也提供一下可用于模型训练的数据集 |
数据集: |
文档里的requirements.txt是Conda 环境导出文件,建议修改为pip的,另外里面只需保留必要的安装依赖项即可,项目看起来用到了optuna,但是安装依赖的文档里没有囊括进来。代码运行训练时,config里只设置了10个epoch,但是程序运行时会迭代重复循环,辛苦检查一下代码逻辑。 |
PR types
New features
PR changes
psc_nn.py
)psc_nn.yaml
)Describe
This PR implements a neural network model for predicting the short-circuit current density (Jsc) of perovskite solar cells. Key features include:
Model Architecture:
Training Features:
Evaluation:
Configuration: