janclemenslab / das

Deep Audio Segmenter
http://janclemenslab.org/das/
Apache License 2.0
28 stars 10 forks source link

Error upon starting to train: weights = self.weights() TypeError: 'numpy.ndarray' object is not callable #31

Closed MaximilianHoffmann closed 2 years ago

MaximilianHoffmann commented 2 years ago
__________________________________________________________________________________________________
activation_15 (Activation)      (None, 62, 32)       0           add_15[0][0]                     
__________________________________________________________________________________________________
dense (Dense)                   (None, 62, 2)        66          activation_15[0][0]              
__________________________________________________________________________________________________
up_sampling1d (UpSampling1D)    (None, 992, 2)       0           dense[0][0]                      
==================================================================================================
Total params: 270,626
Trainable params: 270,626
Non-trainable params: 0
__________________________________________________________________________________________________
INFO:das.train:None
INFO:das.train:Will save to //DAS.res/20220611_151440.
INFO:das.train:start training
Traceback (most recent call last):
  File "//anaconda3/envs/das/lib/python3.9/site-packages/xarray_behave/gui/utils.py", line 222, in run
    self.fn(*self.args, **self.kwargs)
  File "//anaconda3/envs/das/lib/python3.9/site-packages/das/train.py", line 400, in train
    fit_hist = model.fit(
  File "//anaconda3/envs/das/lib/python3.9/site-packages/tensorflow/python/keras/engine/training.py", line 1050, in fit
    data_handler = data_adapter.DataHandler(
  File "//anaconda3/envs/das/lib/python3.9/site-packages/tensorflow/python/keras/engine/data_adapter.py", line 1100, in __init__
    self._adapter = adapter_cls(
  File "//anaconda3/envs/das/lib/python3.9/site-packages/tensorflow/python/keras/engine/data_adapter.py", line 902, in __init__
    super(KerasSequenceAdapter, self).__init__(
  File "///anaconda3/envs/das/lib/python3.9/site-packages/tensorflow/python/keras/engine/data_adapter.py", line 779, in __init__
    peek, x = self._peek_and_restore(x)
  File "//anaconda3/envs/das/lib/python3.9/site-packages/tensorflow/python/keras/engine/data_adapter.py", line 913, in _peek_and_restore
    return x[0], x
  File "///anaconda3/envs/das/lib/python3.9/site-packages/das/data.py", line 282, in __getitem__
    weights = self.weights()
TypeError: 'numpy.ndarray' object is not callable

After annotations and starting train, I'll get the following error. Is this solvable trivially by initializing differently?

nirmalya8 commented 2 years ago

Can I have a look at the code? As far as I can debug by seeing the error, weights is of type numpy.ndarray. To call weights, try weights = self.weights (Without the brackets as it isn't a function). This should work, otherwise have to look at the code.

postpop commented 2 years ago

Oops, that's a typo - thanks for catching that!

I've pushed version 0.26.4 with the fix to pypi - you can update DAS with pip install DAS --update --no-deps. The new version should be available via conda/mamba in an hour or so.

MaximilianHoffmann commented 2 years ago

thx!