maxhodak / keras-molecules

Autoencoder network for learning a continuous representation of molecular structures.
MIT License
521 stars 146 forks source link

TypeError: The numpy boolean negative, the `-` operator, is not supported, use the `~` operator or the logical_not function instead. #76

Open vinayakumarr opened 6 years ago

vinayakumarr commented 6 years ago

python preprocess.py data/smiles_50k.h5 data/processed_50k.h5

Traceback (most recent call last): File "preprocess.py", line 85, in main() File "preprocess.py", line 72, in main apply_fn=lambda ch: np.array(map(one_hot_encoded_fn, File "preprocess.py", line 63, in create_chunk_dataset chunks=tuple([chunk_size]+list(dataset_shape[1:]))) File "/home/vinay/chemistrytensor/local/lib/python2.7/site-packages/h5py/_hl/group.py", line 105, in create_dataset dsid = dataset.make_new_dset(self, shape, dtype, data, **kwds) File "/home/vinay/chemistrytensor/local/lib/python2.7/site-packages/h5py/_hl/dataset.py", line 76, in make_new_dset if isinstance(chunks, tuple) and (-numpy.array([ i>=j for i,j in zip(tmp_shape,chunks) if i is not None])).any(): TypeError: The numpy boolean negative, the - operator, is not supported, use the ~ operator or the logical_not function instead.

maksak commented 6 years ago

Hi,

I think newer h5py solve this issue as the latest h5py seems to avoid your issue. See: https://github.com/h5py/h5py/blob/master/h5py/_hl/dataset.py#L76

3R1K commented 6 years ago

I can confirm @maksak answer works...pip install h5py --upgrade did the trick for me.

chshangy commented 5 years ago

I have the same problem, just open your file File "/home/vinay/chemistrytensor/local/lib/python2.7/site-packages/h5py/_hl/dataset.py", line 76 change the "-" to "~".

mukaddesau commented 5 years ago

You can update your h5py file using this fix: https://github.com/h5py/h5py/commit/973c47f2fb70294ef0cba37a265360e7603f0528 I hope it works.