This repository has been archived by the owner on Apr 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Draft towards a general pair potential class #43
Draft
agoscinski
wants to merge
9
commits into
main
Choose a base branch
from
equistore-pair-potential-draft
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
* 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
agoscinski
force-pushed
the
equistore-pair-potential-draft
branch
from
March 19, 2023 17:11
46c2fbc
to
a0c9b65
Compare
agoscinski
force-pushed
the
equistore-pair-potential-draft
branch
from
March 20, 2023 09:56
a0c9b65
to
fe481b7
Compare
Got to work with i-pi, but it is super hacky code |
agoscinski
force-pushed
the
refactor-to-module
branch
from
May 7, 2023 08:04
0321d22
to
3ad504d
Compare
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.py
file 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.py
which contains the model definition and themodel.pickle
in a zip, then run thescript.py
to get the models definition to then be able to load themodel.pickle
file.📚 Documentation preview 📚: https://equisolve--43.org.readthedocs.build/en/43/