deepsphere / deepsphere-cosmo-tf2

A spherical convolutional neural network for cosmology (TFv2).
https://arxiv.org/abs/1810.12186
MIT License
19 stars 5 forks source link

I have one question about pytest tests and notebook, #6

Closed Rintaro0406 closed 1 year ago

Rintaro0406 commented 1 year ago

I try to run quick_start.ipynb in examples directory and I got the error

TypeError Traceback (most recent call last)

in 1 tf.keras.backend.clear_session() ----> 2 model = HealpyGCNN(nside=nside, indices=indices, layers=layers, n_neighbors=20) 3 batch_size = 16 4 model.build(input_shape=(None, len(indices), 1)) 5 #model.summary(110) ~/deepsphere-cosmo-tf2/deepsphere/healpy_networks.py in __init__(self, nside, indices, layers, n_neighbors) 85 hp_nn.Healpy_Transformer,hp_nn.HealpyBernstein)): 86 # we need to calculate the current L and get the actual layer ---> 87 sphere = SphereHealpix(subdivisions=current_nside, indexes=current_indices, nest=True, 88 k=self.n_neighbors, lap_type='normalized') 89 current_L = sphere.L ~/.local/lib/python3.9/site-packages/pygsp/graphs/nngraphs/spherehealpix.py in __init__(self, subdivisions, indexes, nest, **kwargs) 114 ' {} subdivisions.'.format(k, subdivisions)) 115 --> 116 super(SphereHealpix, self).__init__(coords, k=k, 117 kernel_width=kernel_width, 118 **kwargs) ~/.local/lib/python3.9/site-packages/pygsp/graphs/nngraphs/nngraph.py in __init__(self, features, standardize, metric, order, kind, k, radius, kernel, kernel_width, backend, **kwargs) 417 418 --> 419 neighbors, distances = function(features, metric, order, 420 kind, k, radius, kwargs) 421 # ------ MARTINO's MODIFICATION ------ ~/.local/lib/python3.9/site-packages/pygsp/graphs/nngraphs/nngraph.py in _scipy_ckdtree(features, _, order, kind, k, radius, params) 64 params['k'] = features.shape[0] # number of vertices 65 params['distance_upper_bound'] = radius ---> 66 distances, neighbors = tree.query(features, **params) 67 if kind == 'knn': 68 return neighbors, distances _ckdtree.pyx in scipy.spatial._ckdtree.cKDTree.query() _ckdtree.pyx in scipy.spatial._ckdtree.get_num_workers() TypeError: Unexpected keyword argument {'n_jobs': -1} and also I tested installation via pytest test and got same error in test_gnn_transformers.py tests/test_healpy_networks.py . Now I'm using python 3.9 and I'm program noob. If you have some advice to fix this, it's great to get that.
jafluri commented 1 year ago

Most likely you are using scipy 1.9, please try downgrading your scipy to 1.8

pip install scipy==1.8
Rintaro0406 commented 1 year ago

I created new environment with python 3.6 and installed again. I checked my scipy 1.5, and I got same error...

jafluri commented 1 year ago

Can you pull the latest commit, create a python 3.9 env, install the new requirements and see if the tests run through?

Rintaro0406 commented 1 year ago

Thank you for that. With new environment python 3.9 works well. I didn't get any more error with pytest and notebook. Thank you so much!!