aiqm / torchani

Accurate Neural Network Potential on PyTorch
https://aiqm.github.io/torchani/
MIT License
459 stars 127 forks source link

Wrong array dimension for nnp_training examples #513

Closed ezedonovan closed 3 years ago

ezedonovan commented 3 years ago

Hi ! I'm trying to run both the nnp_training and nnp_training_force examples but I'm getting an error when running:

training, validation = torchani.data.load(dspath).subtract_self_energies(energy_shifter, species_order).species_to_indices(species_order).shuffle().split(0.8, None)

I haven't change anything in the code. Any suggestion is highly appreciated! Thank you The error is:

`LinAlgError Traceback (most recent call last)

in 6 batch_size = 2560 7 ----> 8 training, validation = torchani.data.load(dspath).subtract_self_energies(energy_shifter, species_order).species_to_indices(species_order).shuffle().split(0.8, None) 9 training = training.collate(batch_size).cache() 10 validation = validation.collate(batch_size).cache() ~/anaconda3/envs/luchko/lib/python3.8/site-packages/torchani/data/__init__.py in f(*args, **kwargs) 296 def f(*args, **kwargs): 297 return TransformableIterable( --> 298 transformation(self.wrapped_iterable, *args, **kwargs), 299 self.transformations + (name,)) 300 ~/anaconda3/envs/luchko/lib/python3.8/site-packages/torchani/data/__init__.py in subtract_self_energies(reenterable_iterable, self_energies, species_order) 189 X = numpy.array(X).transpose() 190 Y = numpy.array(Y) --> 191 sae, _, _, _ = numpy.linalg.lstsq(X, Y, rcond=None) 192 sae_ = sae 193 if shifter.fit_intercept: __array_function__ internals in lstsq(*args, **kwargs) ~/anaconda3/envs/luchko/lib/python3.8/site-packages/numpy/linalg/linalg.py in lstsq(a, b, rcond) 2269 if is_1d: 2270 b = b[:, newaxis] -> 2271 _assert_2d(a, b) 2272 m, n = a.shape[-2:] 2273 m2, n_rhs = b.shape[-2:] ~/anaconda3/envs/luchko/lib/python3.8/site-packages/numpy/linalg/linalg.py in _assert_2d(*arrays) 189 for a in arrays: 190 if a.ndim != 2: --> 191 raise LinAlgError('%d-dimensional array given. Array must be ' 192 'two-dimensional' % a.ndim) 193 LinAlgError: 1-dimensional array given. Array must be two-dimensional`
ezedonovan commented 3 years ago

Found the issue. I had to run the bash downloads.sh before hand because the dataset was not there.....