Skip to content

Rename variable names in NNP factory class#283

Merged
wiederm merged 31 commits intomainfrom
rename-variable-model
Oct 19, 2024
Merged

Rename variable names in NNP factory class#283
wiederm merged 31 commits intomainfrom
rename-variable-model

Conversation

@MarshallYan
Copy link
Copy Markdown
Collaborator

@MarshallYan MarshallYan commented Oct 15, 2024

Pull Request Summary

Rename variables to distinguish among "Potential", "ModelTrainer", and "TrainingAdapter" objects in models.py, training.py, test_models.py, and helper_functions.py.

Key changes

Notable points that this PR has either accomplished or will accomplish.

  • "trainer": all ModelTrainer objects
  • "potential": all Potential objects
  • "potential_training_adapter": all TrainingAdapter objects
  • "model": either a ModelTrainer object or a Potential object (will be refactored and separated in another PR)
  • Rename "ModelTrainer" to "PotentialTrainer"

Associated Issue(s)

Pull Request Checklist

  • Issue(s) raised/addressed and linked
  • Includes appropriate unit test(s)
  • Appropriate docstring(s) added/updated
  • Appropriate .rst doc file(s) added/updated
  • PR is ready for review

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Oct 15, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 3 lines in your changes missing coverage. Please review.

Project coverage is 85.34%. Comparing base (e522959) to head (bb3bdb3).
Report is 32 commits behind head on main.

Additional details and impacted files

Copy link
Copy Markdown
Member

@chrisiacovella chrisiacovella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should rename "model.py" to "potential.py". Are you using an IDE where it will automatically refactor? If not I can do this and push a change.

Comment thread modelforge/potential/models.py Outdated

from openff.units import unit

from modelforge.train.training import ModelTrainer
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you going to change the name of ModelTrainer to PotentialTrainer?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That actually makes more sense, and I am changing it now.

Comment thread modelforge/potential/models.py Outdated
inference_neighborlist_strategy: str = "verlet",
verlet_neighborlist_skin: Optional[float] = 0.1,
) -> Union[Potential, JAXModel, pl.LightningModule]:
) -> Union[Potential, JAXModel, pl.LightningModule, ModelTrainer]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, were we going to change this to PotentialTrainer?

@chrisiacovella
Copy link
Copy Markdown
Member

Lint is failing; might just need to check line lengths in model.py, training.py, and test_training.py

@MarshallYan
Copy link
Copy Markdown
Collaborator Author

MarshallYan commented Oct 15, 2024

Pull Request Summary

Rename variables to distinguish among "Potential", "ModelTrainer", and "TrainingAdapter" objects in models.py, training.py, test_models.py, and helper_functions.py.

Key changes

Notable points that this PR has either accomplished or will accomplish.

  • Change 1

Associated Issue(s)

  • Issue 1

Pull Request Checklist

  • Issue(s) raised/addressed and linked
  • Includes appropriate unit test(s)
  • Appropriate docstring(s) added/updated
  • Appropriate .rst doc file(s) added/updated
  • PR is ready for review

We probably should rename "model.py" to "potential.py". Are you using an IDE where it will automatically refactor? If not I can do this and push a change.

@chrisiacovella Are you saying to rename the file and update with git? I can do that, or I can just wait until you push a change to refactor class names inside. For simplicity, could you push a commit of renaming files (if I understood correctly)?

@MarshallYan
Copy link
Copy Markdown
Collaborator Author

MarshallYan commented Oct 15, 2024

Lint is failing; might just need to check line lengths in model.py, training.py, and test_training.py

Yeah I will check. I did rename "self.model" to "self.potential_training_adapter" as they are actually hodling a TrainingAdapter objects which may result in some lines being too long.

Copy link
Copy Markdown
Member

@chrisiacovella chrisiacovella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major change was renaming models.py to potential.py to be consistent with our recently agreed upon naming scheme. While at it, I fixed some of the formatting issues in test_training, and fixed a few of the tests in test_potentials.py that I missed in terms of making sure all tests right to temp directories.

Since the names have changed, the .rst files in the docs still need to be updated to reflect the naming change. I think we can merge after the docs are updated.

Copy link
Copy Markdown
Member

@wiederm wiederm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great changes @MarshallYan and @chrisiacovella !

Comment thread modelforge/potential/potential.py Outdated
Comment thread modelforge/train/training.py Outdated
@wiederm wiederm added enhancement New feature or request refactoring Improve the quality of the code without functional changes and removed enhancement New feature or request labels Oct 16, 2024
@wiederm wiederm linked an issue Oct 16, 2024 that may be closed by this pull request
@chrisiacovella
Copy link
Copy Markdown
Member

It looks like the only thing that still needs to be addressed is updating the .rst files in docs.

Copy link
Copy Markdown
Member

@chrisiacovella chrisiacovella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Let's get this merged.

@wiederm wiederm merged commit 442df66 into main Oct 19, 2024
@wiederm wiederm deleted the rename-variable-model branch October 19, 2024 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Improve the quality of the code without functional changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NNP Factory Class Function Redesign

4 participants