deepsphere / deepsphere-cosmo-tf2

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

Issues testing Deepsphere #13

Open javierhndev opened 5 months ago

javierhndev commented 5 months ago

Hi, I've been having issues running the quick_start notebook (and also the 'pytest test')

The environment I'm using (ujsing you requirements.txt): Python 3.10.12, TF 2.16.1, scipy 1.8.0, no GPU

When I run the quick_start notebook, I got an error when model.build(input_shape=(None, len(indices), 1)) is executed.

The error says: ` File ~/*/deepsphere-cosmo-tf2/deepsphere/gnn_layers.py:81, in Chebyshev.build(self, input_shape) 79 stddev = 1 / np.sqrt(Fin (self.K + 0.5) / 2) 80 initializer = tf.initializers.TruncatedNormal(stddev=stddev) ---> 81 self.kernel = self.add_weight("kernel", shape=[self.K * Fin, Fout], 82 initializer=initializer, self.kwargs) 83 else: 84 self.kernel = self.add_weight("kernel", shape=[self.K * Fin, Fout], 85 initializer=self.initializer, **self.kwargs)

TypeError: Layer.add_weight() got multiple values for argument 'shape' `

When I try the 'pytest tests' I got similar errors: ========================================================== short test summary info ========================================================== FAILED tests/test_gnn_layers.py::test_Chebyshev - TypeError: Layer.add_weight() got multiple values for argument 'shape' FAILED tests/test_gnn_layers.py::test_Monimials - TypeError: Layer.add_weight() got multiple values for argument 'shape' FAILED tests/test_gnn_layers.py::test_Bernstein - TypeError: Layer.add_weight() got multiple values for argument 'shape' FAILED tests/test_gnn_layers.py::test_GCNN_ResidualLayer - TypeError: Exception encountered when calling GCNN_ResidualLayer.call(). FAILED tests/test_gnn_transformers.py::test_Graph_ViT - TypeError: Layer.add_weight() got multiple values for argument 'initializer' FAILED tests/test_gnn_transformers.py::test_Graph_Transformer - TypeError: Layer.add_weight() got multiple values for argument 'initializer' FAILED tests/test_healpy_layers.py::test_HealpyChebyshev - TypeError: Layer.add_weight() got multiple values for argument 'shape' FAILED tests/test_healpy_layers.py::test_HealpyMonomial - TypeError: Layer.add_weight() got multiple values for argument 'shape' FAILED tests/test_healpy_layers.py::test_Healpy_ResidualLayer - TypeError: Exception encountered when calling GCNN_ResidualLayer.call(). FAILED tests/test_healpy_networks.py::test_HealpyGCNN_plotting - TypeError: Layer.add_weight() got multiple values for argument 'shape' FAILED tests/test_healpy_networks.py::test_HealpyGCNN - TypeError: Layer.add_weight() got multiple values for argument 'shape'

Is a problem of the environment? Have you encountered this before? Thank you!

jafluri commented 5 months ago

Hello,

Thanks for your interest in DeepSphere and sorry for the late reply. I am currently traveling and have only limited internet access for some time.

Have you tried downgrading your Tensorflow version, e.g. to 2.14?

Once I am back, I'll be able to recreate the environment and help you more.

Best,

Janis

javierhndev commented 5 months ago

Thank you! That was it. I downgraded Tensorflow to 2.14.0 and now it works!

Also, another small issue I found in the 'advanced tutorial'. Current versions of numpy complain about 'np.bool' since it was deprecated. Switching to 'bool' was fine.

jafluri commented 5 months ago

Great, thanks for letting me know. I will leave the issue open until I have time to fix everything properly.