Skip to content

【Hackathon 10th Spring No.7】wD-MPNN模型复现 RFC#1349

Open
megemini wants to merge 5 commits intoPaddlePaddle:masterfrom
megemini:wD-MPNN
Open

【Hackathon 10th Spring No.7】wD-MPNN模型复现 RFC#1349
megemini wants to merge 5 commits intoPaddlePaddle:masterfrom
megemini:wD-MPNN

Conversation

@megemini
Copy link
Copy Markdown
Contributor

【Hackathon 10th Spring No.7】wD-MPNN模型复现 RFC

关联:

https://github.com/PaddlePaddle/community/blob/master/hackathon/hackathon_10th/%E3%80%90Hackathon_10th%E3%80%91%E5%BC%80%E6%BA%90%E8%B4%A1%E7%8C%AE%E4%B8%AA%E4%BA%BA%E6%8C%91%E6%88%98%E8%B5%9B%E6%98%A5%E8%8A%82%E7%89%B9%E5%88%AB%E5%AD%A3%E2%80%94%E4%BB%BB%E5%8A%A1%E5%90%88%E9%9B%86.md#no6---no19-paddlemateirals%E6%A8%A1%E5%9E%8B%E5%A4%8D%E7%8E%B0

PaddlePaddle/PaddleMaterials#194

目前进度:

已测试通过 quick_test.py 与 test_alignment.py,还需要补充 readme 文档:

(venv310)  shun@shun-B660M-Pro-RS  ~/workspace/Projects/megemini/PaddleMaterials   wD-MPNN ±  python test_wd_mpnn/test_alignment.py
============================================================
Alignment Test: polymer-chemprop PyTorch vs PaddlePaddle
============================================================

Using polymer-chemprop from: /home/shun/workspace/Projects/github/paddle_material_workspace/polymer-chemprop

[TEST] Featurization Alignment
/home/shun/venv310/lib/python3.10/site-packages/paddle/utils/cpp_extension/extension_utils.py:715: UserWarning: No ccache found. Please be aware that recompiling all source files may be required. You can download and install ccache from: https://github.com/ccache/ccache/blob/master/doc/INSTALL.md
  warnings.warn(warning_message)
Setting molecule featurization parameters to default.
  onek_encoding_unk: ALIGNED
  atom_features: ALIGNED
  bond_features: ALIGNED
  MolGraph construction: ALIGNED (tested 5 molecules)
  PASS: test_featurization_alignment

[TEST] BatchMolGraph Alignment
Setting molecule featurization parameters to default.
  f_atoms: ALIGNED
  f_bonds: ALIGNED
  w_atoms: ALIGNED
  w_bonds: ALIGNED
  a2b: ALIGNED
  b2a: ALIGNED
  b2revb: ALIGNED
  a_scope, b_scope: ALIGNED
  PASS: test_batch_mol_graph_alignment

[TEST] MPNEncoder Weight Transfer & Output
Setting molecule featurization parameters to default.
  Dimensions match: atom_fdim=133, bond_fdim=147
W0420 23:21:02.746806 263995 gpu_resources.cc:114] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 12.2, Runtime API Version: 11.8
  Weights transferred from PyTorch to Paddle
  PyTorch output shape: (3, 64)
  Paddle output shape: (3, 64)
  PyTorch output (first 5): [0.0946798  0.         0.00467052 0.         0.04161105]
  Paddle output (first 5): [0.09467981 0.         0.00467052 0.         0.04161105]
  Max absolute difference: 4.66e-08
  MPNEncoder output: ALIGNED
  PASS: test_model_weight_transfer_and_output

[TEST] Full Model Alignment
Setting molecule featurization parameters to default.
  Transferred 9 parameters, skipped 0
  PyTorch output: [-0.07015474 -0.14300832]
  Paddle output: [-0.07015475 -0.14300826]
  Max absolute difference: 5.96e-08
  Full model output: ALIGNED
  PASS: test_full_model_alignment

[TEST] Predict Alignment
Setting molecule featurization parameters to default.
  PyTorch predict output: [0.18144765 0.06510229 0.08535291 0.16595763]
  Paddle predict output:  [0.18144765 0.06510232 0.08535293 0.16595766]
  Max absolute difference: 2.98e-08
  Predict output: ALIGNED
  PASS: test_predict_alignment

[TEST] Train Alignment
Setting molecule featurization parameters to default.
  PyTorch loss: 0.21089630
  Paddle loss:  0.21089625
  Forward loss: ALIGNED
  Max weight difference after 1 step: 1.49e-08
  Updated weights: ALIGNED
  Max output difference after 1 step: 1.49e-07
  Post-step output: ALIGNED
  PASS: test_train_alignment

[TEST] Real Data Predict Alignment
  Loaded 50 molecules from regression.csv
Setting molecule featurization parameters to default.
  Total predictions: 50
  Max absolute difference: 1.49e-07
  Real data predict: ALIGNED
  PASS: test_real_data_predict_alignment

[TEST] Real Data Train Alignment
  Train: 80, Test: 20
  Target mean: [-3.4775875], std: [2.224332]
Setting molecule featurization parameters to default.
  Epoch 0: max batch loss diff so far = 1.19e-07
  Epoch 1: max batch loss diff so far = 1.19e-07
  Epoch 2: max batch loss diff so far = 1.19e-07
  Max loss difference across all batches: 1.19e-07
  Per-batch training loss: ALIGNED
  Post-training test predictions max diff: 4.77e-07
  Post-training predictions: ALIGNED
  PASS: test_real_data_train_alignment

[TEST] Pipeline Predict Alignment
Setting molecule featurization parameters to default.
  Paddle dataset: 50 samples
  Total predictions: 50
  Max absolute difference: 1.79e-07
  Pipeline predict: ALIGNED
  PASS: test_pipeline_predict_alignment

[TEST] Pipeline Train Alignment
Setting molecule featurization parameters to default.
  Epoch 0: max batch loss diff so far = 1.19e-07
  Epoch 1: max batch loss diff so far = 1.19e-07
  Epoch 2: max batch loss diff so far = 1.19e-07
  Max loss difference across all batches: 1.19e-07
  Per-batch training loss: ALIGNED
  Post-training test predictions max diff: 4.77e-07
  Post-training predictions: ALIGNED
  PASS: test_pipeline_train_alignment

============================================================
Results: 10 passed, 0 failed, 10 total
============================================================
(venv310)  shun@shun-B660M-Pro-RS  ~/workspace/Projects/megemini/PaddleMaterials   wD-MPNN ±  python test_wd_mpnn/quick_test.py    
/home/shun/venv310/lib/python3.10/site-packages/paddle/utils/cpp_extension/extension_utils.py:715: UserWarning: No ccache found. Please be aware that recompiling all source files may be required. You can download and install ccache from: https://github.com/ccache/ccache/blob/master/doc/INSTALL.md
  warnings.warn(warning_message)
============================================================
Quick Test: polymer-chemprop → PaddleMaterials conversion
============================================================

[TEST] Featurization Config
  atom_fdim=133, bond_fdim=147
  PASS: test_featurization_config

[TEST] MolGraph
  CCO: n_atoms=3, n_bonds=4
  PASS: test_mol_graph

[TEST] BatchMolGraph
  Batch: f_atoms shape=[14, 133], a_scope=[(1, 3), (4, 6), (10, 4)]
  PASS: test_batch_mol_graph

[TEST] mol2graph
  PASS: test_mol2graph

[TEST] index_select_ND
W0420 23:21:12.146291 264203 gpu_resources.cc:114] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 12.2, Runtime API Version: 11.8
  PASS: test_index_select_nd

[TEST] Activation Functions
  PASS: test_activation_functions

[TEST] MPNEncoder
  MPNEncoder output shape: [3, 64]
  PASS: test_mpn_encoder

[TEST] MPN
  MPN output shape: [3, 64]
  PASS: test_mpn

[TEST] Model Forward
  Model loss: 1.475724
  Prediction shape: [3, 2]
  PASS: test_model_forward

[TEST] Model Backward
  PASS: test_model_backward

[TEST] Dataset & Collator
  Dataset: 4 samples, first target = 1.5
  Collator: labels shape = [3, 1]
  PASS: test_dataset_and_collator

[TEST] End-to-End
  End-to-end loss: 0.696244
  Predictions: [0.26211184 0.28943834 0.34291458]
  PASS: test_end_to_end

[TEST] Classification Mode
  Classification loss: 0.623281
  PASS: test_classification_mode

============================================================
Results: 13 passed, 0 failed, 13 total
============================================================

@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented Apr 20, 2026

你的PR提交成功,感谢你对开源项目的贡献!
请检查PR提交格式和内容是否完备,具体请参考示例模版
Your PR has been submitted. Thanks for your contribution!
Please check its format and content. For this, you can refer to Template and Demo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants