Giter VIP home page Giter VIP logo

mixture_of_experts_keras's Issues

Ask about RuntimeError: Graph disconnected

Dear Shibuiwilliam,
Thank you so much for your github about mixture of experts for keras.
I learnt a lot from them.
I have a problem related to "Graph disconnected" when I try to use them for my system.

  • I have 6 experts that are 6 different parallel CNN structures, and using the same input. The input of experts are a pair of 4D arrays, in which size of them is (None, 128,50,1) and each expert includes Input layer for the first layer of a model and returning of each model is model=Model([input1,input2], output) - these are differences to your expert structures.
  • I get output of these experts: e0, e1, e2, e3, e4, e5 by calling "model.output"
  • I define a gating model including Input layer like other experts and followed layers like yours (dense, dropout, reshape)
  • The below code is my MoE_output and MoE_model.
    '''
    from keras.layers import Lambda
    MoE_output = Lambda(lambda gx: (gx[0]*gx[6][:,:,0]) + (gx[1]*gx[6][:,:,1])+
    (gx[2]*gx[6][:,:,2]) + (gx[3]*gx[6][:,:,3])+
    (gx[4]*gx[6][:,:,4]) + (gx[5]*gx[6][:,:,5])
    , output_shape=(10,))([e0, e1, e2, e3, e4, e5, gating_model.output])
    X1_tmp = Input(shape=(X1_train.shape[1:]))
    X2_tmp = Input(shape=(X2_train.shape[1:]))
    MoE_model = Model(inputs=[X1_tmp, X2_tmp], outputs=MoE_output)
    '''
    --->If I do not use Input layers for these array inputs, they will cause a error" unhashbleerror: numpy.array"
    since in topology.py of keras, there is an unsatified condition "len(set(seft.inputs))"!= len(self.inputs)"
    so I change these array inputs to tensors by using Input layer of keras.

-->If I use Input layers and then build MoE_model as above, it will launch graphic disconnected error.
Althought I check Input of experts, they are same as <Tensor("input_2_6:0", shape=(?, 128, 50, 1), dtype=float32) >
'''
*** RuntimeError: Graph disconnected: cannot obtain value for tensor Tensor("input_2_6:0", shape=(?, 128, 50, 1), dtype=float32) at layer "input_2". The following previous layers were accessed without issue: []
'''
Please give me some advise to solve this problem.
Looking forward to hearing from you soon
Thank you so much,
Truc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.