aiqm / torchani Goto Github PK
View Code? Open in Web Editor NEWAccurate Neural Network Potential on PyTorch
Home Page: https://aiqm.github.io/torchani/
License: MIT License
Accurate Neural Network Potential on PyTorch
Home Page: https://aiqm.github.io/torchani/
License: MIT License
Waiting for:
setup.py
to allow install on machine that do not have sphinxexamples/
['H', 'H', 'C']
into tensor like tensor([0, 0, 1])
Would it be possible to create a __version__
attribute or similar so that individual runs can be reproduced? We usually recommend versioneer or similar for this kind of operation.
Edge branch is PyTorch's master with the following PRs merged:
torch.combinations
: pytorch/pytorch#9393tensor.device
, etc. in JIT: pytorch/pytorch#12363cosine_similarity
: pytorch/pytorch#12199Outdated list:
Wait for pytorch/pytorch#10978 to be resolved and remove pad
and pad_coordinates
in https://github.com/aiqm/torchani/blob/master/torchani/utils.py
Wait for pytorch/pytorch#12206 to be resolved to make utils.present_species
JITable
Hi @zasdfgbnm
I get a different energy every time I use the energy_force.py example in the qrefine branch of torchani.
('Energy:', -40.30905532836914)
('Energy:', -40.434627532958984)
('Energy:', -40.549381256103516)
('Energy:', -40.627140045166016)
('Energy:', -40.549705505371094)
('Energy:', -40.49227523803711)
This is using phenix.python which is built on python 2.7.15
To ensure phenix.python was not causing the problem, I used a conda environment with python 2.7.3
('Energy:', -40.51961135864258)
('Energy:', -40.46982955932617)
In comparison, the latest version of torchani running on python 3.7.2 leads to consistent energies when I run energy_force.py:
Energy: -40.425621032714844
Energy: -40.425621032714844
Energy: -40.425621032714844
Visualizing AEV parameter changes
When trying to install torchANI as instructed in the installation notes everything goes OK when installing pytorch, but the pip part to install torchANI fails:
(torchani) [henrique@cpd08 ~] $ conda install pytorch-nightly -c pytorch
Solving environment: done
## Package Plan ##
environment location: /home/henrique/bin/anaconda3/envs/torchani
added / updated specs:
- pytorch-nightly
The following NEW packages will be INSTALLED:
blas: 1.0-mkl
ca-certificates: 2018.03.07-0
certifi: 2018.11.29-py37_0
cffi: 1.11.5-py37he75722e_1
intel-openmp: 2019.1-144
libedit: 3.1.20170329-h6b74fdf_2
libffi: 3.2.1-hd88cf55_4
libgcc-ng: 8.2.0-hdf63c60_1
libgfortran-ng: 7.3.0-hdf63c60_0
libstdcxx-ng: 8.2.0-hdf63c60_1
mkl: 2019.1-144
mkl_fft: 1.0.6-py37hd81dba3_0
mkl_random: 1.0.2-py37hd81dba3_0
ncurses: 6.1-he6710b0_1
ninja: 1.8.2-py37h6bb024c_1
numpy: 1.15.4-py37h7e9f1db_0
numpy-base: 1.15.4-py37hde5b4d6_0
openssl: 1.1.1a-h7b6447c_0
pip: 18.1-py37_0
pycparser: 2.19-py37_0
python: 3.7.1-h0371630_7
pytorch-nightly: 1.0.0.dev20190101-py3.7_cuda9.0.176_cudnn7.4.1_0 pytorch
readline: 7.0-h7b6447c_5
setuptools: 40.6.3-py37_0
sqlite: 3.26.0-h7b6447c_0
tk: 8.6.8-hbc83047_0
wheel: 0.32.3-py37_0
xz: 5.2.4-h14c3975_4
zlib: 1.2.11-h7b6447c_3
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(torchani) [henrique@cpd08 ~] $ pip install torchani
Collecting torchani
Using cached https://files.pythonhosted.org/packages/26/49/b7b92a8e7467164fdbf1c6850b57be66ed0144aeb4b4a492ece9cada89c0/torchani-0.2.1-py3-none-any.whl
Collecting pytorch-ignite-nightly (from torchani)
Using cached https://files.pythonhosted.org/packages/89/85/804ec40744ccba56e5a2b061e0e2f1c8c90289c33a878f0ce9fce35422ef/pytorch_ignite_nightly-20190101-py2.py3-none-any.whl
Collecting torch-nightly (from torchani)
Could not find a version that satisfies the requirement torch-nightly (from torchani) (from versions: )
No matching distribution found for torch-nightly (from torchani)
Waiting for: pytorch/ignite#306
hi @zasdfgbnm,
I think the dataset .h5 files:
are corrupted when I use:
git clone https://github.com/aiqm/torchani.git
I then installed torchani, and tested the energy_force.py script successfully.
But when I run:
python nnp_training.py
I get an error:
Error:
File "h5py/h5f.pyx", line 85, in h5py.h5f.open
OSError: Unable to open file (file signature not found)
To solve the problem:
I download the four individual .h5 files manually from the Github website using the download button.
I then copied the files to the dataset folder.
Then the training script works as expected.
I am using:
- Mac OS X 10.14.2
- anaconda3
- Python 3.7.2
- torchani.version = '0.2.2'
- torch.version = '1.0.0.dev20190214'
- h5py.version = '2.9.0'
Wait for pytorch/pytorch#9393 to be merged and remove AEVComputer. _combinations
from TorchANI
Hey. I love your project :) Just wanted to point out that if there are no atoms with Rca
distance the code crashes with the following stack trace because of empty array leading to n=0
.
I guess it might make sense to handle this somehow?
/shared/sdoerr/Software/miniconda3/envs/torchani/lib/python3.6/site-packages/torch/nn/modules/container.py in forward(self, input)
90 def forward(self, input):
91 for module in self._modules.values():
---> 92 input = module(input)
93 return input
94
/shared/sdoerr/Software/miniconda3/envs/torchani/lib/python3.6/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
475 result = self._slow_forward(*input, **kwargs)
476 else:
--> 477 result = self.forward(*input, **kwargs)
478 for hook in self._forward_hooks.values():
479 hook_result = hook(self, input, result)
/shared/sdoerr/Software/miniconda3/envs/torchani/lib/python3.6/site-packages/torchani/aev.py in forward(self, species_coordinates)
294
295 radial_terms, angular_terms, indices_r, indices_a = \
--> 296 self._terms_and_indices(species, coordinates)
297 mask_r = self._compute_mask_r(species_, indices_r)
298 mask_a = self._compute_mask_a(species_, indices_a, present_species)
/shared/sdoerr/Software/miniconda3/envs/torchani/lib/python3.6/site-packages/torchani/aev.py in _terms_and_indices(self, species, coordinates)
180 vec = vec.gather(-2, _indices_a)
181
--> 182 vec = self._combinations(vec, -2)
183 angular_terms = self._angular_subaev_terms(*vec)
184
/shared/sdoerr/Software/miniconda3/envs/torchani/lib/python3.6/site-packages/torchani/aev.py in _combinations(self, tensor, dim)
198 index1 = grid_y.masked_select(
199 torch.triu(torch.ones(n, n, device=tensor.device),
--> 200 diagonal=1) == 1)
201 index2 = grid_x.masked_select(
202 torch.triu(torch.ones(n, n, device=tensor.device),
RuntimeError: invalid argument 1: expected a matrix at /opt/conda/conda-bld/pytorch-nightly_1540805525195/work/aten/src/TH/generic/THTensorMoreMath.cpp:1270
File "/home/clean/phenix-1.14rc1-3177/build/../modules/qrefine/command_line/refine.py", line 116, in
run(args=sys.argv[1:], log=log)
File "/home/clean/phenix-1.14rc1-3177/build/../modules/qrefine/command_line/refine.py", line 111, in run
log = log)
File "/home/clean/phenix-1.14rc1-3177/modules/qrefine/qr.py", line 368, in run
model = model)
File "/home/clean/phenix-1.14rc1-3177/modules/qrefine/qr.py", line 243, in create_restraints_manager
clustering = params.cluster.clustering)
File "/home/clean/phenix-1.14rc1-3177/modules/qrefine/restraints.py", line 101, in init
self.qm_engine = self.create_qm_engine()
File "/home/clean/phenix-1.14rc1-3177/modules/qrefine/restraints.py", line 127, in create_qm_engine
calculator = TorchAni()
File "/home/clean/phenix-1.14rc1-3177/modules/qrefine/plugin/ase/torchani_qr.py", line 36, in init
from_nc=network_dir, ensemble=8)
File "/home/clean/phenix-1.14rc1-3177/base/lib/python2.7/site-packages/torch/jit/init.py", line 555, in init_then_register
original_init(self, *args, **kwargs)
File "/home/clean/phenix-1.14rc1-3177/base/lib/python2.7/site-packages/torchani/nn.py", line 399, in init
self.aev_computer.dtype, self.aev_computer.device, filename)
File "/home/clean/phenix-1.14rc1-3177/base/lib/python2.7/site-packages/torch/jit/init.py", line 555, in init_then_register
original_init(self, *args, **kwargs)
File "/home/clean/phenix-1.14rc1-3177/base/lib/python2.7/site-packages/torchani/nn.py", line 57, in init
layer_setups = self._parse(buffer)
File "/home/clean/phenix-1.14rc1-3177/base/lib/python2.7/site-packages/torchani/nn.py", line 123, in _parse
tree = parser.parse(nnf_file)
File "/home/clean/phenix-1.14rc1-3177/base/lib/python2.7/site-packages/lark/lark.py", line 197, in parse
return self.parser.parse(text)
File "/home/clean/phenix-1.14rc1-3177/base/lib/python2.7/site-packages/lark/parser_frontends.py", line 137, in parse
return self.parser.parse(text)
File "/home/clean/phenix-1.14rc1-3177/base/lib/python2.7/site-packages/lark/parsers/xearley.py", line 126, in parse
column = scan(i, column)
File "/home/clean/phenix-1.14rc1-3177/base/lib/python2.7/site-packages/lark/parsers/xearley.py", line 115, in scan
raise UnexpectedInput(stream, i, text_line, text_column, {item.expect for item in to_scan}, set(to_scan))
lark.lexer.UnexpectedInput: No token defined for: '-' in u'-3671' at line 47 col 11
Expecting: set(['INT', 'FLOAT', u'__FILE3'])
model:ani-1ccx_8x
same model running with ANI not got error
Dataset outputs of dict, with keys like "coordinates", "species", "energies", the output of dataset is chunk, which is different conformations of the same molecule.
Dataloader samples a batch of several chunks, and concat fields that are concatable (those that has shape independent on number of atoms in a molecule)
torchani.ignite.Container
accepts a TODO
Wait for pytorch/pytorch#9532 to be merged and remove list operations for the shape in https://github.com/aiqm/torchani/blob/master/torchani/aev.py
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.