-
Notifications
You must be signed in to change notification settings - Fork 218
[Example] Add Chem Suzuki-Miyaura 交叉偶联反应产率预测 #1175
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?
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.
无关内容请不要修改
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.
已恢复权限
ppsci/externals/paddle_sparse
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.
无关改动请删除
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.
paddle_sparse已经试着加回来了,不知道这样处理是否合适?不行的话我就重新clone一份然后把现在这个分支全部覆盖掉
examples/chem/Chem.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.
文件名建议用全小写的 chem.py或者main.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.
已修改
examples/chem/Chem.py
Outdated
global x_train, y_train | ||
x_train, y_train = data_processed(x_train, y_train) | ||
|
||
# 构建约束 |
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.
已按照建议修改
examples/chem/Chem.py
Outdated
"batch_size": cfg.TRAIN.batch_size, | ||
}, | ||
loss=ppsci.loss.MSELoss("mean"), | ||
name="bc_sup", |
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.
这个名字可以直接用"sup","bc_sup"有一些歧义,你这个案例里应该不会涉及 boundary condition之类的概念吧
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/chem/config/chem.yaml
Outdated
defaults: # | ||
- ppsci_default # | ||
- TRAIN: train_default # | ||
- EVAL: eval_default # | ||
# - INFER: infer_default # | ||
- _self_ # |
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.
建议改成如下内容
defaults: # | |
- ppsci_default # | |
- TRAIN: train_default # | |
- EVAL: eval_default # | |
# - INFER: infer_default # | |
- _self_ # | |
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_ | |
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/chem/config/chem.yaml
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.
连续空行保留一行即可
ppsci/arch/chem.py
Outdated
def __init__( | ||
self, input_dim, hidden_dim, hidden_dim2, hidden_dim3, hidden_dim4, output_dim | ||
): | ||
super(ChemMultimodalMLP, self).__init__() |
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.
super(ChemMultimodalMLP, self).__init__() | |
super().__init__() | |
ppsci/arch/chem.py
Outdated
|
||
# 确保权重与特征的维度一致 | ||
weights = weights.clone().detach() | ||
|
||
# 计算加权和 | ||
weighted_sum = sum(f * w for f, w in zip(features, weights)) | ||
|
||
# 计算权重和 | ||
total_weight = weights.sum() | ||
|
||
# 返回加权平均 |
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.
[ppsci/arch/chem.py]的内容已按照建议修改
ppsci/arch/chem.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.
本文件中的注释可以删除,多余空行也请删除
还需要上传与实验结果对应的模型参数,请问怎么操作? |
@leeleolay 看下 |
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.
- 几处小问题还麻烦修改下
- @leeleolay 帮忙上传下数据
docs/zh/examples/chem.md
Outdated
``` sh | ||
# 训练: | ||
python chem.py mode=train | ||
``` |
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 | |
# 训练: | |
python chem.py mode=train | |
``` | |
``` sh | |
python chem.py | |
``` |
docs/zh/examples/chem.md
Outdated
``` sh | ||
# 评估: | ||
python chem.py mode=eval | ||
``` |
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 | |
# 评估: | |
python chem.py mode=eval | |
``` | |
``` sh | |
python chem.py mode=eval | |
``` |
examples/chem/chem.py
Outdated
solver.train() | ||
|
||
|
||
def eval(cfg: DictConfig): |
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.
def eval(cfg: DictConfig): | |
def evaluate(cfg: DictConfig): |
examples/chem/chem.py
Outdated
if cfg.mode == "train": | ||
train(cfg) | ||
elif cfg.mode == "eval": | ||
eval(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.
eval(cfg) | |
evaluate(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.
函数名已修改
案例名字建议修改为SMCReac或其他有辨识度的名字,Chem的范围太大了 |
https://paddle-org.bj.bcebos.com/paddlescience/datasets/SMCReac/data_set.xlsx 数据可参考这个链接,代码里可删除数据文件 |
https://paddle-org.bj.bcebos.com/paddlescience/docs/SMCReac/chem.png 图片可参考这个链接 原始文件可删除 |
案例文件夹重命名为smc_reac,模型重命名为SuzukiMiyauraModel |
在smc_reac.md文档中已经新增数据集链接,并删除样例文件夹中的数据文件 |
…ence into dev_model_chem
PR types
PR changes
Describe
Suzuki-Miyaura 交叉偶联反应是在零价钯配合物催化下,芳基或烯基硼酸或硼酸酯与氯、溴、碘代芳烃或烯烃发生交叉偶联。该反应具有反应条件温和、转化率高的优点,在材料合成、药物研发等领域具有重要作用,但存在开发周期长,试错成本高的问题。本研究通过使用高通量实验数据分析反应底物(包括亲电试剂和亲核试剂),催化配体,碱基,溶剂对偶联反应产率的影响,从而建立预测模型。