duolinwang / MusiteDeep_web

This repository contains the stand-alone tool for MusiteDeep server
http://www.musite.net
MIT License
29 stars 16 forks source link

Package compatibility issue with MusiteDeep script | ubuntu 20.04 | python 3.8 #1

Open tviguier opened 2 years ago

tviguier commented 2 years ago

Hello ! I'm very interested in your MusiteDeept script to analyze protein sequences and predict tyrosine phoshorylation sites using the different models you propose.

Your site works great but I want to run your script alone (Stand Alone version)

I am currently running ubuntu 20.04 with python 3.8 and I have some package compatibility problems Here are the package import modifications I was able to do on different python scripts at the root : (# old import line ; --> new line)

FILE : capsulenet_callback.py

from keras.utils import to_categorical --> from tensorflow.keras.utils import to_categorical

from keras.engine.topology import Layer ---> from tensorflow.keras.layers import Layer, InputSpec

from keras.layers.normalization import BatchNormalization

--> from tensorflow.keras.models import Sequential from tensorflow.keras.layers import (BatchNormalization, SeparableConv2D, MaxPooling2D, Activation, Flatten, Dropout, Dense) from tensorflow.keras import backend as K

class CancerNet: @staticmethod def build(width, height, depth, classes): model = Sequential() shape = (height, width, depth) channelDim = -1

    if K.image_data_format() == "channels_first":
        shape = (depth, height, width)
        channelDim = 1

    model.add(SeparableConv2D(32, (3, 3), padding="same", input_shape=shape))
    model.add(Activation("relu"))
    model.add(BatchNormalization(axis=channelDim))
    model.add(MaxPooling2D(pool_size=(2, 2)))
    model.add(Dropout(0.25))

    model.add(SeparableConv2D(64, (3, 3), padding="same"))
    model.add(Activation("relu"))
    model.add(BatchNormalization(axis=channelDim))
    model.add(SeparableConv2D(64, (3, 3), padding="same"))
    model.add(Activation("relu"))
    model.add(BatchNormalization(axis=channelDim))
    model.add(MaxPooling2D(pool_size=(2, 2)))
    model.add(Dropout(0.25))

    model.add(SeparableConv2D(128, (3, 3), padding="same"))
    model.add(Activation("relu"))
    model.add(BatchNormalization(axis=channelDim))
    model.add(SeparableConv2D(128, (3, 3), padding="same"))
    model.add(Activation("relu"))
    model.add(BatchNormalization(axis=channelDim))
    model.add(SeparableConv2D(128, (3, 3), padding="same"))
    model.add(Activation("relu"))
    model.add(BatchNormalization(axis=channelDim))
    model.add(MaxPooling2D(pool_size=(2, 2)))
    model.add(Dropout(0.25))

    model.add(Flatten())
    model.add(Dense(256))
    model.add(Activation("relu"))
    model.add(BatchNormalization())
    model.add(Dropout(0.5))

    model.add(Dense(classes))
    model.add(Activation("softmax"))

    return model

model = CancerNet()

FILE : mutltiCNN_callback.py

from keras.optimizers import SGD --> from tensorflow.keras.optimizers import SGD

from keras.layers.normalization import BatchNormalization

--> from tensorflow.keras.models import Sequential from tensorflow.keras.layers import (BatchNormalization, SeparableConv2D, MaxPooling2D, Activation, Flatten, Dropout, Dense) from tensorflow.keras import backend as K

class CancerNet: @staticmethod def build(width, height, depth, classes): model = Sequential() shape = (height, width, depth) channelDim = -1

    if K.image_data_format() == "channels_first":
        shape = (depth, height, width)
        channelDim = 1

    model.add(SeparableConv2D(32, (3, 3), padding="same", input_shape=shape))
    model.add(Activation("relu"))
    model.add(BatchNormalization(axis=channelDim))
    model.add(MaxPooling2D(pool_size=(2, 2)))
    model.add(Dropout(0.25))

    model.add(SeparableConv2D(64, (3, 3), padding="same"))
    model.add(Activation("relu"))
    model.add(BatchNormalization(axis=channelDim))
    model.add(SeparableConv2D(64, (3, 3), padding="same"))
    model.add(Activation("relu"))
    model.add(BatchNormalization(axis=channelDim))
    model.add(MaxPooling2D(pool_size=(2, 2)))
    model.add(Dropout(0.25))

    model.add(SeparableConv2D(128, (3, 3), padding="same"))
    model.add(Activation("relu"))
    model.add(BatchNormalization(axis=channelDim))
    model.add(SeparableConv2D(128, (3, 3), padding="same"))
    model.add(Activation("relu"))
    model.add(BatchNormalization(axis=channelDim))
    model.add(SeparableConv2D(128, (3, 3), padding="same"))
    model.add(Activation("relu"))
    model.add(BatchNormalization(axis=channelDim))
    model.add(MaxPooling2D(pool_size=(2, 2)))
    model.add(Dropout(0.25))

    model.add(Flatten())
    model.add(Dense(256))
    model.add(Activation("relu"))
    model.add(BatchNormalization())
    model.add(Dropout(0.5))

    model.add(Dense(classes))
    model.add(Activation("softmax"))

    return model

model = CancerNet()

FILE : attention.py

from keras.engine.topology import Layer --> from tensorflow.keras.layers import Layer, InputSpec

from keras.engine import InputSpec --> None

My last error on the terminal looks like this :

TypeError: Exception encountered when calling layer "digitcaps" (type CapsuleLayer_nogradient_stop).

in user code:

File "/home/thomas/MusiteDeep_web/MusiteDeep/capsulelayers.py", line 233, in call  *
    c = tf.nn.softmax(b, dim=1)

TypeError: Got an unexpected keyword argument 'dim'

Call arguments received:
   • inputs=tf.Tensor(shape=(None, 360, 8), dtype=float32)
   • training=False

Since that, I'm stuck because I don't know how to fix this. Is it possible to fix this problem or do I have to go back to the ubuntu and python version you used (16.04.5 and 3.5.2) to run the script correctly?

Thanks in advance for your answer !

Abhishaike commented 1 year ago

Did you ever fix this? Having the same issue