-
Notifications
You must be signed in to change notification settings - Fork 14
Add ase_interface with support for optimization and md #176
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?
Changes from all commits
69aa46b
deea169
37ed942
1c75f1d
06c3c3e
ee55f16
0226096
c32fabd
6023fe5
0d3354f
9a2dc78
f8b5710
24d6b70
a34fef1
59614f5
6eeafb6
ab05190
52f050a
d841f0d
77d164f
e8ce0be
3ddeb0c
a83c8c4
e2ea426
578522a
b556ff1
623ffc0
70bca7f
d713a86
743d006
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -339,6 +339,18 @@ def read_data(self, path: str): | |
| path (str): Path to the data. | ||
| """ | ||
| json_data = read_json(path) | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个地方的改动是为什么? |
||
| # # Example: Load a small subset of the dataset for quick testing | ||
| # num_samples = 1000 | ||
| # json_data_subset = {} | ||
| # count = 0 | ||
| # for k, v in json_data.items(): | ||
| # json_data_subset[k] = v | ||
| # count += 1 | ||
| # if count >= num_samples: | ||
| # break | ||
| # json_data = json_data_subset | ||
|
|
||
| return json_data | ||
|
|
||
| def filter_unvalid_by_property(self): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -310,9 +310,9 @@ class DimeNetPlusPlus(paddle.nn.Layer): | |
| a graph-level feature (“mean” or “sum”). Defaults to "mean". | ||
| property_names (Optional[str], optional): A comma-separated list of | ||
| target property names to predict. Defaults to "formation_energy_per_atom". | ||
| data_norm_mean (float, optional): The mean used for normalizing target values. | ||
| data_mean (float, optional): The mean used for normalizing target values. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里为什么这么改 |
||
| Defaults to 0.0. | ||
| data_norm_std (float, optional): The standard deviation used for | ||
| data_std (float, optional): The standard deviation used for | ||
| normalizing target values. Defaults to 1.0. | ||
| loss_type (str, optional): Loss type, can be 'mse_loss' or 'l1_loss'. | ||
| Defaults to "l1_loss". | ||
|
|
@@ -339,8 +339,8 @@ def __init__( | |
| num_output_layers: int = 3, | ||
| readout: str = "mean", | ||
| property_names: Optional[str] = "formation_energy_per_atom", | ||
| data_norm_mean: float = 0.0, | ||
| data_norm_std: float = 1.0, | ||
| data_mean: float = 0.0, | ||
| data_std: float = 1.0, | ||
| loss_type: str = "l1_loss", | ||
| act: str = "swish", | ||
| ): | ||
|
|
@@ -357,10 +357,10 @@ def __init__( | |
| assert isinstance(property_names, str) | ||
| self.property_names = property_names | ||
| self.register_buffer( | ||
| tensor=paddle.to_tensor(data_norm_mean), name="data_norm_mean" | ||
| tensor=paddle.to_tensor(data_mean), name="data_mean" | ||
| ) | ||
| self.register_buffer( | ||
| tensor=paddle.to_tensor(data_norm_std), name="data_norm_std" | ||
| tensor=paddle.to_tensor(data_std), name="data_std" | ||
| ) | ||
|
|
||
| # basis layers | ||
|
|
@@ -445,10 +445,10 @@ def triplets(self, edge_index, num_nodes): | |
| ) | ||
|
|
||
| def normalize(self, tensor): | ||
| return (tensor - self.data_norm_mean) / self.data_norm_std | ||
| return (tensor - self.data_mean) / self.data_std | ||
|
|
||
| def unnormalize(self, tensor): | ||
| return tensor * self.data_norm_std + self.data_norm_mean | ||
| return tensor * self.data_std + self.data_mean | ||
|
|
||
| def _forward(self, data): | ||
| # The data in data['graph'] is numpy.ndarray, convert it to paddle.Tensor | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. predictor里面为什么要暴露StructureSampler |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved. | ||
|
|
||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
|
|
||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| from ppmat.predictor.base import BasePredictor | ||
| from ppmat.predictor.sample import StructureSampler | ||
|
|
||
| __all__ = [ | ||
| "BasePredictor", | ||
| "StructureSampler", | ||
| ] |
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.
这里?