BIMSBbioinfo / janggu

Deep learning infrastructure for genomics
GNU General Public License v3.0
254 stars 33 forks source link

Compatibility with keras >=2.30 and tensorflow 2 #10

Closed PedroBarbosa closed 4 years ago

PedroBarbosa commented 4 years ago

Hi,

Thanks for the great package, I'm just getting started and doing some preliminary tests. I use the tensorflow implementation of the keras API (tf.keras), and it seems that Cover datasets and the ReduceDim wrapper are not accepted as valid types:

ValueError: Failed to find data adapter that can handle input: <class 'janggu.data.coverage.Cover'>, <class 'janggu.data.nparr.ReduceDim'

Any plans to update janggu to allow this integration ? When I do model.fit(np.asarray(x), np.asarray(y)) it works just fine. Is there any custom function within janggu to convert Cover datasets into pure numpy arrays ?

Best, Pedro

wkopp commented 4 years ago

Thank you, Pedro, for the feedback.

I will look into enabling compatibility for keras >=2.30 and tensorflow 2. Meanwhile, please continue wrapping the datasets with np.asarray as you have suggested.

Best, Wolfgang

wkopp commented 4 years ago

Hi Pedro,

I've added/adapted JangguSequence which you can also use with the new keras/tensorflow interface to train a native keras model. This way, one does not need to unpack the dataset in advance. An example of how to use this is shown in src/examples/keras_convnet_example_w_sequence.ipynb.

I'll close this issue for now, but feel free to reopen it if something is unclear. Best, Wolfgang