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

full ensemble fix, feature model fix #332

Merged
merged 14 commits into from
Sep 9, 2024
Merged

full ensemble fix, feature model fix #332

merged 14 commits into from
Sep 9, 2024

Conversation

M-R-Schaefer
Copy link
Contributor

added ensemble output for full ensembles to ASE calc
minor changes to feature model for enhanced sampling

apax/nn/models.py Show resolved Hide resolved
Comment on lines 85 to 88
ensemble = {k + "_ensemble": v for k, v in results.items()}
results = {k: jnp.mean(v, axis=0) for k, v in results.items()}
results.update(uncertainty)
results.update(ensemble)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean, when using any kind of ensemble, we will have:

{energy: float, energy_ensemble: list[float], forces: ndarray[N, 3], forces_ensemble: ndarray[m, N, 3]}

and so on? I see where this can be very useful, but for the sake of performance it might be a good idea to make this toggleable? For e.g. saving to h5 the amount of data will increase noticeably?

Copy link
Contributor

Choose a reason for hiding this comment

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

I also opened zincware/ZnH5MD#136 but I think this option should be available on both sides?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes these are now available for all types of ensemble. passing arguments to the ASE calculator in IPS is a bit cumbersome at the moment. You always need a second node in addition to the training node (otherwise you have to retrain when changing the ASE options).
The inference speed should actually not be affected, but yes the storage size will increase significantly. Storing the ensemble predictions is relevant for some UQ metrics and reweighting.
I guess I can add an optional white list to the ASE calculator which filters the results by keys. same for jaxMD.
it seems like a cleaner solution to me to specify this in the h5 writer, but I can also implement it on the apax side.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it doesn't hurt to implement it here as well, but I agree that it is more useful on the znh5md side.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah right, I forgot about ASE. Yeah I can do that for ASE as well, but it's not going to be very ergonomic for IPSuite.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have to say that this would be really unergonomical when using the ASECalculator in IPSuite. I think models should return what they return and which properties are logged should be part of the trajectory writer. If I implement this as part of the ASECalc, it would mean that we train a model with a specified list of outputs and changing these properties would require a retraining or using a separate Node.
So I think this was a good addition to jaxMD (as it is implemented in the trajectory writer), but for the ASECalculator it makes everything more complicated.

@M-R-Schaefer
Copy link
Contributor Author

pre-commit.ci autofix

@M-R-Schaefer
Copy link
Contributor Author

pre-commit.ci autofix

@M-R-Schaefer
Copy link
Contributor Author

pre-commit.ci autofix

Copy link
Contributor

@PythonFZ PythonFZ left a comment

Choose a reason for hiding this comment

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

Looks great. I added two more optional comments.

@M-R-Schaefer M-R-Schaefer merged commit b601606 into main Sep 9, 2024
2 checks passed
@M-R-Schaefer M-R-Schaefer deleted the erbs_fixes branch September 9, 2024 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants