deepmodeling / dpgen2

2nd generation of the Deep Potential GENerator
https://docs.deepmodeling.com/projects/dpgen2/
GNU Lesser General Public License v3.0
33 stars 26 forks source link

Fix caly evo step slice #225

Closed wangzyphysics closed 6 months ago

wangzyphysics commented 6 months ago

Summary by CodeRabbit

coderabbitai[bot] commented 6 months ago
Walkthrough ## Walkthrough The changes introduce significant updates to the `dpgen2` module, focusing on enhancing the Calypso exploration configuration. New functions and arguments were added to handle Calypso-specific parameters, while existing functions and tests were modified to integrate these changes. Additionally, deprecated methods were replaced, and configuration files were updated to reflect the new exploration modes and configurations. ## Changes | Files | Change Summary | |-------|----------------| | dpgen2/entrypoint/args.py | Added `run_expl_caly_conf_args()` and `caly_args()` functions; modified `variant_explore()` to use `caly_args()` for Calypso variant. | | dpgen2/entrypoint/submit.py | Adjusted logic for `explore_style` parameter; updated `expl_mode` assignment in `make_concurrent_learning_op` and `workflow_concurrent_learning` functions. | | dpgen2/exploration/render/traj_render_lammps.py | Added `_load_one_model_devi_deprecated` method; updated `_load_one_model_devi` to handle 1D data. | | dpgen2/op/prep_caly_model_devi.py | Renamed `template_slice_config` to `expl_config` in `get_input_sign` and `execute` functions. | | dpgen2/op/run_caly_dp_optim.py | Updated default command in `config` dictionary to include `model.ckpt.pt`. | | dpgen2/op/run_caly_model_devi.py | Deprecated `parse_traj` function; added new `parse_traj` function with enhanced trajectory data processing. | | dpgen2/superop/prep_run_calypso.py | Introduced `caly_evo_step_slice_config` initialization and modification based on `expl_mode`. | | examples/calypso/input.test.json | Removed `mode` and `_mode` parameters; adjusted `template_slice_config` and `explore` sections; added `model_devi_group_size`. | | dpgen2/superop/caly_evo_step.py | Updated `__init__` method to include `expl_mode` parameter; modified `_caly_evo_step` method to use class instance `caly_evo_step_steps`. | | tests/op/test_prep_caly_model_devi.py | Renamed variables related to model deviation group sizes; updated test assertions. | | tests/op/test_run_caly_model_devi.py | Modified test setup with new `Atoms` configurations and file paths; expanded assertions in test methods. | | tests/test_prep_run_caly.py | Adjusted configuration settings in test cases `test_caly_evo_step_merge_merge_mode` and `test_caly_evo_step_merge_default_mode`. | | dpgen2/exploration/task/make_task_group_from_config.py | Added `opt_step` argument to `caly_task_grp_args` function. | | dpgen2/exploration/task/__init__.py | Removed `make_task_group_from_config` declaration. | ## Sequence Diagram(s) (Beta) ```mermaid sequenceDiagram participant User participant CLI participant ArgsModule as dpgen2/entrypoint/args.py participant SubmitModule as dpgen2/entrypoint/submit.py participant CalypsoModule as dpgen2/op/run_caly_model_devi.py User->>CLI: Run Calypso exploration CLI->>ArgsModule: Parse arguments ArgsModule->>CLI: Return Calypso-specific arguments CLI->>SubmitModule: Submit exploration job SubmitModule->>CalypsoModule: Execute exploration with new config CalypsoModule-->>SubmitModule: Return exploration results SubmitModule-->>CLI: Exploration job completed CLI-->>User: Display results ```

Recent review details **Configuration used: CodeRabbit UI** **Review profile: CHILL**
Commits Files that changed from the base of the PR and between 17adfb67079eeb2d9abc1eb86f2054c734a7fa23 and 9773936403b58ee9201cc27e03dad4261fbc4f38.
Files selected for processing (1) * dpgen2/exploration/task/__init__.py (1 hunks)
Additional context used
Ruff
dpgen2/exploration/task/__init__.py
2-2: `.caly_task_group.CalyTaskGroup` imported but unused; consider removing, adding to `__all__`, or using a redundant alias --- 5-5: `.conf_sampling_task_group.ConfSamplingTaskGroup` imported but unused; consider removing, adding to `__all__`, or using a redundant alias --- 8-8: `.customized_lmp_template_task_group.CustomizedLmpTemplateTaskGroup` imported but unused; consider removing, adding to `__all__`, or using a redundant alias --- 11-11: `.lmp_template_task_group.LmpTemplateTaskGroup` imported but unused; consider removing, adding to `__all__`, or using a redundant alias --- 14-14: `.make_task_group_from_config.caly_normalize` imported but unused; consider removing, adding to `__all__`, or using a redundant alias --- 15-15: `.make_task_group_from_config.caly_task_group_args` imported but unused; consider removing, adding to `__all__`, or using a redundant alias --- 18-18: `.make_task_group_from_config.lmp_normalize` imported but unused; consider removing, adding to `__all__`, or using a redundant alias --- 21-21: `.make_task_group_from_config.lmp_task_group_args` imported but unused; consider removing, adding to `__all__`, or using a redundant alias --- 22-22: `.make_task_group_from_config.make_calypso_task_group_from_config` imported but unused; consider removing, adding to `__all__`, or using a redundant alias --- 23-23: `.make_task_group_from_config.make_lmp_task_group_from_config` imported but unused; consider removing, adding to `__all__`, or using a redundant alias --- 24-24: `.make_task_group_from_config.variant_task_group` imported but unused; consider removing, adding to `__all__`, or using a redundant alias --- 27-27: `.npt_task_group.NPTTaskGroup` imported but unused; consider removing, adding to `__all__`, or using a redundant alias --- 30-30: `.stage.ExplorationStage` imported but unused; consider removing, adding to `__all__`, or using a redundant alias --- 33-33: `.task.ExplorationTask` imported but unused; consider removing, adding to `__all__`, or using a redundant alias --- 36-36: `.task_group.BaseExplorationTaskGroup` imported but unused; consider removing, adding to `__all__`, or using a redundant alias --- 37-37: `.task_group.ExplorationTaskGroup` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
--- Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
codecov[bot] commented 6 months ago

Codecov Report

Attention: Patch coverage is 83.63636% with 9 lines in your changes missing coverage. Please review.

Project coverage is 84.40%. Comparing base (9408071) to head (9773936). Report is 31 commits behind head on master.

Files with missing lines Patch % Lines
dpgen2/entrypoint/submit.py 28.57% 5 Missing :warning:
dpgen2/op/run_caly_model_devi.py 86.95% 3 Missing :warning:
dpgen2/exploration/render/traj_render_lammps.py 50.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #225 +/- ## ========================================== + Coverage 84.23% 84.40% +0.17% ========================================== Files 95 95 Lines 5214 5246 +32 ========================================== + Hits 4392 4428 +36 + Misses 822 818 -4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

wangzyphysics commented 6 months ago

Please check the following part. it seems that when "calypso:merge" and "calypso:default" are not supported.

https://github.com/deepmodeling/dpgen2/blob/837e0259bd3ee499d0282e1c9856ab4d6b447c28/dpgen2/exploration/task/make_task_group_from_config.py#L510-L511

please raise an error if no condition is hit.

This func make_task_group_from_config is not in use any more.

def make_naive_exploration_scheduler(
    config,
):
    # use npt task group
    explore_style = config["explore"]["type"]

    if explore_style == "lmp":
        return make_lmp_naive_exploration_scheduler(config)
    elif "calypso" in explore_style:
        return make_calypso_naive_exploration_scheduler(config)
    else:
        raise KeyError(
            f"Unknown key `{explore_style}`, Only support `lmp`, `calypso`, `calypso:merge` and `calypso:default`."
        )