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

Use handwritten cosine similarity #520

Merged
merged 1 commit into from
Nov 2, 2020
Merged

Use handwritten cosine similarity #520

merged 1 commit into from
Nov 2, 2020

Conversation

zasdfgbnm
Copy link
Contributor

because it is faster.

Before:

torchani.aev.cutoff_cosine - 2.0s
torchani.aev.radial_terms - 0.7s
torchani.aev.angular_terms - 6.1s
torchani.aev.compute_shifts - 0.0s
torchani.aev.neighbor_pairs - 0.0s
torchani.aev.neighbor_pairs_nopbc - 1.9s
torchani.aev.triu_index - 0.0s
torchani.aev.cumsum_from_zero - 0.5s
torchani.aev.triple_by_molecule - 3.4s
torchani.aev.compute_aev - 15.8s
Total AEV - 15.8s
NN - 4.1s
Epoch time - 30.3s

After:

torchani.aev.cutoff_cosine - 1.6s
torchani.aev.radial_terms - 0.7s
torchani.aev.angular_terms - 5.6s
torchani.aev.compute_shifts - 0.0s
torchani.aev.neighbor_pairs - 0.0s
torchani.aev.neighbor_pairs_nopbc - 1.8s
torchani.aev.triu_index - 0.0s
torchani.aev.cumsum_from_zero - 0.5s
torchani.aev.triple_by_molecule - 3.3s
torchani.aev.compute_aev - 15.0s
Total AEV - 15.0s
NN - 3.9s
Epoch time - 29.4s

Copy link
Member

@farhadrgh farhadrgh left a comment

Choose a reason for hiding this comment

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

LGTM! Maybe try import collection.abc to fix the mypy error

@zasdfgbnm zasdfgbnm merged commit d0ab8a8 into master Nov 2, 2020
@zasdfgbnm zasdfgbnm deleted the angular-opt branch November 2, 2020 17:24
zasdfgbnm added a commit to roitberg-group/torchani that referenced this pull request Dec 17, 2020
* Kill python 2.7 style super (aiqm#496)

* Specify dtype for species (aiqm#502)

* Specify dtype for species

For some reason, sometimes species are constructed as int tensors instead of long tensors, this is wrong and should be fixed

* Update __init__.py

* Include model parameter placeholders in site-packages (aiqm#500)

* skip downloading into site-packages

* add placeholder files

* add placeholder files

* dont check filesize in local_dir

* fix shutil erro

* use distutils instead of shutils

* Update JCIM issue numer, year (aiqm#506)

* Update JCIM issue

* Add cover and retrigger build

* Distribute source tarball and wheel to PyPI (aiqm#508)

* Distribute source and weel

* trigger

* fix

* Disable Final for 3.6 (aiqm#509)

* Disable Final for 3.6

* dont run mypy for 3.6

* Update aev.py (aiqm#510)

* Raise error for unknown species (aiqm#512)

* raise error for unknown species

* make it jittable

* fix dimension bug

* Use torch.linalg.norm instead of torch.norm (aiqm#515)

torch.norm is deprecated and may be removed in a future PyTorch release.

* Use handwritten cosine similarity (aiqm#520)

* Simplify pair computation on AEV (aiqm#519)

* Simplify pair computation on AEV

* save

Co-authored-by: Farhad Ramezanghorbani <[email protected]>

* Update CODEOWNERS (aiqm#523)

* Add clang-format ci (aiqm#524)

* Add clang-format ci

* format

Co-authored-by: Farhad Ramezanghorbani <[email protected]>

* Update installation guide to mention conda (aiqm#525)

* Add dummy cuda extension build (aiqm#521)

* Add dummy cuda extension build

* save

* run tests

* save

* fix

* pytorch cu110

* no vision

* save

* nl

* save

* save

* save

* save

* save

* save

* save

* autopep8

* more autopep8

* optional=True

* no todo

* fix

* refactor ci

* mypy

* save

* flake8

* os error

* Run cuaev test

* save

* clang format

* Delete delete-me.cu

* Search for cub in pytorch include paths

* nl

* instructions on test

* Add better handle cuaev install/not install

* test_cuaev.py

* clean

* fix

Co-authored-by: Farhad Ramezanghorbani <[email protected]>

* Rename pipelines so that they are better displayed (aiqm#526)

* Rename pipelines so that they are better displayed

* Update unittest.yml

* Update clang-format.yml

* Update clang-format.yml

* Update README.md

* Update runnable_submodules.yml

* Update README.md

* Update cuda.yml (aiqm#528)

* Update setup.py (aiqm#529)

* Make CUDA extension TorchScript compatible (aiqm#527)

* Make CUDA extension TorchScript compatible

* save

* save

* fix

* save

* save

* save

* save

* Update install_dependencies.sh

* trigger ci

* save

* fix

* save

* save

* save

* save

* try

* fix

* revert

* save

* save

* mypy

* Add mypy coverage (aiqm#530)

* Use PyTorch autograd's hessian (aiqm#532)

* Use PyTorch autograd's hessian

* fix test

* save

* clean

* save

* save

* drop hessian from jit example

* delete old commented code (#7) (aiqm#536)

Co-authored-by: Ignacio Pickering <[email protected]>

* Faster tests  (#8) (aiqm#537)

* modifications to make tests faster

* Now ani1x is not loaded for any aev_computer necessary

* flake*

* Avoid test warnings by loading from json and setting initial velocities to a small number

* Avoid loading from cif in ManualMirror and Repeat also

* Add comments to clarify test_energies and delete unused variable

* Fix inaccurate comment

* Delete unused variable in test_ensemble

* Add comments and clarifications to test_ase

* flake8

Co-authored-by: Ignacio Pickering <[email protected]>

* Using the lalr parser loads networks x2 faster (#9) (aiqm#538)

Co-authored-by: Ignacio Pickering <[email protected]>

* Small modifications in code and comments to clarify (#11) (aiqm#539)

Co-authored-by: Ignacio Pickering <[email protected]>

* delete all python2 style super calls (#14) (aiqm#540)

* delete all python2 style super calls

* flake8

Co-authored-by: Ignacio Pickering <[email protected]>

* Add sync before functions and print a warning if not synching  (#17) (aiqm#542)

* Make training benchmark print a warning if not synchronizing, and add a sync before function also

* Take triu_index out since it does not run

* slightly increase default precision

* flake8

Co-authored-by: Ignacio Pickering <[email protected]>

* Fix periodic table (#23) (aiqm#544)

* Change 0th index of periodic table

* Change species converter to reflect new convention

* Change None for 'Dummy' and fix flake8

Co-authored-by: Ignacio Pickering <[email protected]>

* Revert "Use PyTorch autograd's hessian (aiqm#532)" (aiqm#534)

This reverts commit bd9d888.

* Intuitive aev computer classmethod (#18) (aiqm#543)

* Add classmethod for conveniently building AEVComputer

* Fix bug

* Add test

* flake8

* Small change in assert

* rename to zeta for consistency with other code

* trigger tests

* What the hell Dropbox?! -.-

Co-authored-by: Ignacio Pickering <[email protected]>

* Cherry-pick #10 (aiqm#545)

* Add convenience functions useful for active learning [WIP] (#10)

* Add convenience functions useful for active learning

* avoid training outputs

* modify gitignore

* Add convenience functions to directly get atomic energies

* fix bug

* fix mypy

* flake8

* fix bugs

* flake8

* mypy

* Add tests for functions

* add test to workflows and flake8

* empty to trigger tests

* trigger

* delete new test

* readd new test

* avoid training outputs

* trigger

* trigger tests again, they are all passing on my side

* fix isclose in tests

* save

* fix

Co-authored-by: Ignacio Pickering <[email protected]>

* Use PyTorch's TestCase to compare tensor (aiqm#533)

* Use PyTorch's TestCase to compare tensor

* save

* save

* save

* save

* save

* save

* save

* save

* save

* Update test_energies.py

* Update test_ase.py

* save

* flake8

* Cherry-pick #15 (aiqm#541)

* Move parsing resource code to neurochem/ (#15)

* Move parsing resource code to neurochem/

* fix bug

* fix

* fix

Co-authored-by: Ignacio Pickering <[email protected]>

* Cherry-pick #22 (aiqm#546)

* commit farhads and jinzes changes to fix some bugs [WIP] (#22)

* commit farhads and jinzes changes to fix some bugs

* Add tests for correct inputs

* add missing

* fix

Co-authored-by: Ignacio Pickering <[email protected]>

* More about cuaev (aiqm#547)

* More about cuaev

* Update setup.py

* save

* clang-format

* Add code snippet to save validation and training sets in nnp_training (aiqm#548)

* CUDA port for AEV computation (aiqm#516)

* cuda port for aev computation

* benchmark, setup and import

* fix bug

* fix flake8 and jit

* fix collections.abc for python>3.7

* setup gitingore

* format code with formatter

* ignore more

* Use torch API to set streams

* Use pytorch's caching allocator

* empty line

* fix

* cuaev correntness testr, instruction of install on readme

* readme

* fix readme

* fix readme

* fix readme

* fix readme

* add usage in readme

* fix readme

* add test in readme

* fix readme

* -std=c++14

* bug fix - add async data copy

* bug fix - add missing stream sync

* code refactor and cosmetic changes

* aev benchmark for big protein

* remove mdtraj

* remove print

* move pdb to dataset folder

* cosmetic changes

* Move torchani/extensions -> torchani/cuaev

* clang-format -i

* cleanup

* return aev from cuComputeAEV

* Update aev.py

* Update aev.py

* fix flake8

* fix LGTM unused local variable

* clang-format

* fix

* save

* install change

Co-authored-by: richard <[email protected]>
Co-authored-by: Xiang Gao <[email protected]>

* provide better error message (aiqm#550)

* clang-format line-limit to 120 (aiqm#552)

* clang-format

* line-limit 120

* CRLF to LF (aiqm#553)

* line-limit 120

* CRLF to LF

* fix cuaev angular kernel when center atom pairs are more than 32 (aiqm#555)

* Update docs.yml (aiqm#557)

* Update docs.yml

* Update docs.yml

* Update docs.yml

* Update docs.yml

* Update docs.yml

* Update docs.yml

* Apply suggestions from code review

Co-authored-by: Richard Xue <[email protected]>

Co-authored-by: Richard Xue <[email protected]>

* Do no require grad in ASE calculator (aiqm#559)

Co-authored-by: Gao, Xiang <[email protected]>

* flake8

Co-authored-by: Gao, Xiang <[email protected]>
Co-authored-by: Farhad Ramezanghorbani <[email protected]>
Co-authored-by: Richard Xue <[email protected]>
Co-authored-by: Alon Grinberg Dana <[email protected]>
Co-authored-by: akkamesh <[email protected]>
Co-authored-by: zubatyuk <[email protected]>
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