This repository was archived by the owner on Apr 24, 2024. It is now read-only.
Draft towards a general pair potential class#43
Draft
agoscinski wants to merge 9 commits intomainfrom
Draft
Conversation
* rm not implemented errors * add metaclass to estimator and transformer
Because we want to allow people to transfert their NumpyModule to a TorchModule so they can get access to TorchScript (see issue #42) we need to change the way how we do the inheritance. Before it was Module (reference to torch.nn.Module or our BaseModule) --> CustomModule (e.g. Ridge) But that means when loading the library there is just one class CustomModule that even inherits from torch.nn.Module or BaseModule depending if torch is available on the machine. With one inheritance, it is hard switch between the classes. Changing the base class is very hacky, so this is not a good approach. There we create both classes when torch is present (note BaseModule wase renamed to NumpyModule) def factory_custom_module(base): class _CustomModule(base): ... # change name ... return _CustomModule CustomNumpyModule = factory_custom_module(NumpyModule) CustomTorchModule = factory_custom_module(torch.nn.Module) if HAS_TORCH: CustomModule = CustomTorchModule else: CustomModule = CustomNumpyModule
* also added example and model file to run example
46c2fbc to
a0c9b65
Compare
a0c9b65 to
fe481b7
Compare
Collaborator
Author
|
Got to work with i-pi, but it is super hacky code |
0321d22 to
3ad504d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the next iteration of a class that can interface with MD codes with the feedback from PR #10
The corresponding i-pi driver is implemented here. I decided to move the code logic of the driver here, so one does not switch between repo's to understand the concept
Here is the corresponding branch in i-pi agoscinski/i-pi#2 which should work in the future.
It is still not functional. But I think it's enough to have another discussion in which direction this should go.
I did not had time to include an option to save the pickle model together with the
script.pyfile in a zip in PR #41 like TorchScript does itequisolve/src/equisolve/module.py
Line 147 in 8385523
The idea is to store the
script.pywhich contains the model definition and themodel.picklein a zip, then run thescript.pyto get the models definition to then be able to load themodel.picklefile.📚 Documentation preview 📚: https://equisolve--43.org.readthedocs.build/en/43/