Skip to content
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

Spin lmp #34

Open
wants to merge 199 commits into
base: lmp_base
Choose a base branch
from
Open

Spin lmp #34

wants to merge 199 commits into from

Conversation

iProzd
Copy link
Owner

@iProzd iProzd commented Sep 26, 2024

No description provided.

njzjz and others added 13 commits September 21, 2024 03:34
Fix deepmodeling#4151.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced path filtering logic to include a broader range of keys when
generating subpaths.
  
- **Bug Fixes**
	- Improved the accuracy of path results returned by the `glob` method.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
See deepmodeling#4147 and deepmodeling#4143.
We can first make `state_dict` safe for `weights_only`, then make a
breaking change when loading `state_dict` in the future.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Enhanced model saving functionality by ensuring learning rates are
consistently stored as floats, improving type consistency.
  
- **Bug Fixes**
- Updated model loading behavior in tests to focus solely on model
weights, which may resolve issues related to state dictionary loading.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
…modeling#4153)

Per discussion in
deepmodeling#4142 (comment).
It should not be a public API as it lacks maintainance.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced a new `eval_model` function in the testing module to
enhance model evaluation capabilities with various input configurations.

- **Bug Fixes**
- Removed the old `eval_model` function from the main module to
streamline functionality and improve code organization.

- **Refactor**
- Consolidated the import of `eval_model` to a common module across
multiple test files for better organization and reduced dependencies.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: Han Wang <92130845+wanghan-iapcm@users.noreply.github.com>
…one` (deepmodeling#4155)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved error handling by ensuring that the output data is not `None`
before processing, preventing potential runtime errors.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

- **New Features**
- Introduced JAX support, enhancing functionality and compatibility with
JAX library.
	- Added new `JAXBackend` class for backend integration with JAX.
	- New functions for converting between NumPy and JAX arrays.

- **Bug Fixes**
- Improved compatibility of neural network layers with array API
standards.

- **Tests**
- Added tests for JAX functionality and consistency checks against
reference outputs.
- Enhanced testing framework for activation functions and type
embeddings.

- **Chores**
	- Updated dependency requirements to include JAX library.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Fix failed uts in deepmodeling#4145 .

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Added a `"seed"` property to multiple JSON configuration files,
enhancing control over randomness in model training and evaluation.
- Introduced a global seed parameter in various test functions to
improve reproducibility across test runs.

- **Bug Fixes**
- Ensured consistent random number generation in tests by integrating a
global seed parameter.

- **Documentation**
- Updated configuration files and test methods to reflect the addition
of the seed parameter for clarity and consistency.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
…nsional data causes error (deepmodeling#4145)

Fix issue deepmodeling#4108 

If a pretrained model is labeled with energy and the `out_bias` is one
dimension. If we want to finetune a dos/polar/dipole/property model
using this pretrained model, the `out_bias` of finetuning model is
multi-dimension(example: numb_dos = 250). An error occurs:
`RuntimeError: Error(s) in loading state_dict for ModelWrapper:`
` size mismatch for model.Default.atomic_model.out_bias: copying a param
with shape torch.Size([1, 118, 1]) from checkpoint, the shape in current
model is torch.Size([1, 118, 250]).`
` size mismatch for model.Default.atomic_model.out_std: copying a param
with shape torch.Size([1, 118, 1]) from checkpoint, the shape in current
model is torch.Size([1, 118, 250]).`

When using new fitting, old out_bias is useless because we will
recompute the new bias in later code. So we do not need to load old
out_bias when using new fitting finetune.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Enhanced parameter collection for fine-tuning, refining criteria for
parameter retention.
- Introduced a model checkpoint file for saving and resuming training
states, facilitating iterative development.

- **Tests**
- Added a new test class to validate training and fine-tuning processes,
ensuring model performance consistency across configurations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
caic99 and others added 6 commits September 27, 2024 00:38
`dp --pt freeze` does not output whether the operation finishes
successfully. This PR adds a log message on it.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced a function to transform electronic configuration data into
a spin representation, enhancing how electronic states are represented.
- Updated the electronic configuration embedding to include negative
values, reflecting a new encoding scheme.
- Added a normalization function for electronic configuration vectors to
improve data consistency.

- **Tests**
- Added a new test for the spin representation functionality to ensure
accuracy of the transformation for iron (Fe).
	- Updated existing tests to align with the new expected output format.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Han Wang <wang_han@iapcm.ac.cn>
Co-authored-by: Duo <50307526+iProzd@users.noreply.github.com>
<!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.6.5 →
v0.6.7](astral-sh/ruff-pre-commit@v0.6.5...v0.6.7)
- https://github.com/pylint-dev/pylint/: v3.2.7 → v3.3.0
<!--pre-commit.ci end-->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Han Wang <92130845+wanghan-iapcm@users.noreply.github.com>
Co-authored-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Comment on lines 378 to 379
// std::vector<double> virtual_len;
// std::vector<double> spin_norm;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
std::vector<int> extend_numneigh;
std::vector<std::vector<int>> extend_neigh;
std::vector<int*> extend_firstneigh;
// std::vector<double> extend_dcoord;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
select_real_atoms_coord(dcoord, datype, aparam_, nghost_real, fwd_map,
bkw_map, nall_real, nloc_real, coord, atype, aparam,
nghost, ntypes, 1, daparam, nall, aparam_nall);
int nloc = nall_real - nghost_real;

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable nloc is not used.
Comment on lines 462 to 466
// spin model not suported yet
// torch::Tensor flat_virial_ = virial_.toTensor().view({-1}).to(floatType);
// torch::Tensor cpu_virial_ = flat_virial_.to(torch::kCPU);
// virial.assign(cpu_virial_.data_ptr<VALUETYPE>(),
// cpu_virial_.data_ptr<VALUETYPE>() + cpu_virial_.numel());

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
// cpu_atom_virial_.data_ptr<VALUETYPE>(),
// cpu_atom_virial_.data_ptr<VALUETYPE>() + cpu_atom_virial_.numel());
atom_energy.resize(static_cast<size_t>(nframes) * fwd_map.size());
// atom_virial.resize(static_cast<size_t>(nframes) * fwd_map.size() * 9);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
Comment on lines 748 to 752
// spin model not suported yet
// torch::Tensor flat_virial_ = virial_.toTensor().view({-1}).to(floatType);
// torch::Tensor cpu_virial_ = flat_virial_.to(torch::kCPU);
// virial.assign(cpu_virial_.data_ptr<VALUETYPE>(),
// cpu_virial_.data_ptr<VALUETYPE>() + cpu_virial_.numel());

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
// virial.assign(cpu_virial_.data_ptr<VALUETYPE>(),
// cpu_virial_.data_ptr<VALUETYPE>() + cpu_virial_.numel());
if (atomic) {
// c10::IValue atom_virial_ = outputs.at("atom_virial");

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
}

if (dtype == tensorflow::DT_DOUBLE) {
int ret = session_input_tensors<double>(

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable ret is not used.
nframes, nghost_real);
}
} else {
int ret = session_input_tensors<float>(

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable ret is not used.
@@ -1198,7 +1245,12 @@
}
}

comm_reverse = numb_models * 3;
// comm_reverse = numb_models * 3;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
njzjz and others added 6 commits October 2, 2024 10:06
Fix deepmodeling#3864.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced logic for detecting TensorFlow installation paths and
requirements.
	- Improved error handling for TensorFlow version detection.

- **Bug Fixes**
- Adjusted compatibility specifications for the `h5py` dependency on
aarch64 architecture.

- **Documentation**
- Updated comments to clarify changes in TensorFlow detection and
compatibility issues.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

- **Documentation**
- Updated installation instructions to reference the new LAMMPS version
`stable_29Aug2024_update1`.

- **New Features**
- Enhanced build scripts to support the updated LAMMPS version across
various installation methods.

- **Chores**
- Adjusted dependency management settings to reflect the new LAMMPS
version in configuration files.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

- **New Features**
- Introduced new functionality for handling input data conversion
between different versions.
- Added `EnvMatStatSe` class for enhanced environmental matrix
statistics calculations.
- Implemented a mechanism to track the status of atoms (real vs.
virtual) in `BaseAtomicModel`.

- **Bug Fixes**
- Updated Python version requirements across documentation and
configuration files to Python 3.9 or above.

- **Documentation**
- Updated installation guides to reflect the new Python version
requirement and clarified virtual environment setup instructions.

- **Chores**
- Refined dependency management in `pyproject.toml` to support newer
Python versions and improve version control.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Fix deepmodeling#4171.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
	- Enhanced GPU selection logic for improved resource management.
- Added support for single-frame and multi-frame computations with new
parameters for atom energy and virial calculations.
	- Extended functionality for mixed-type computations in the model.

- **Bug Fixes**
	- Improved error handling during initialization and model execution.
- Added output tensor dimension validations to ensure expected
structures are maintained.

- **Documentation**
- Clarified output tensor validation to ensure expected dimensions are
maintained.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Fix deepmodeling#4122.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced error handling in the computation process, providing clearer
error messages for invalid local cell numbers.
  
- **Bug Fixes**
- Improved robustness of the `compute_cell_info` function to prevent
failures due to invalid input conditions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
<!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.6.7 →
v0.6.8](astral-sh/ruff-pre-commit@v0.6.7...v0.6.8)
- [github.com/pre-commit/mirrors-clang-format: v18.1.8 →
v19.1.0](pre-commit/mirrors-clang-format@v18.1.8...v19.1.0)
- https://github.com/pylint-dev/pylint/: v3.3.0 → v3.3.1
<!--pre-commit.ci end-->

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
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.