Giter Club home page Giter Club logo

Comments (14)

philipperemy avatar philipperemy commented on August 11, 2024 2

Max is now 20.

from cond_rnn.

philipperemy avatar philipperemy commented on August 11, 2024 1

Okay I pushed 3.2.1. Make sure your version is not python 3.11. I tested it with python3.8 and it works great.

!pip install --upgrade cond-rnn

from cond_rnn.

hsinyuku avatar hsinyuku commented on August 11, 2024

The following is the complete code modified by the test_con_rnn.py.

def create_conditions(NUM_SAMPLES, NUM_CLASSES):
    conditions = np.zeros(shape=[NUM_SAMPLES, NUM_CLASSES])
    for i, kk in enumerate(conditions):
             kk[i % NUM_CLASSES] = 1
    return conditions
def main():
    i = Input(shape=[time_steps, input_dim], name='input_0')
    c1 = Input(shape=[num_classes], name='input_1')
    c2 = Input(shape=[num_classes], name='input_2')
    c3 = Input(shape=[num_classes], name='input_3')
    c4 = Input(shape=[num_classes], name='input_4')
    c5 = Input(shape=[num_classes], name='input_5')
    c6 = Input(shape=[num_classes], name='input_6')
    c7 = Input(shape=[num_classes], name='input_7')
    c8 = Input(shape=[num_classes], name='input_8')
    c9 = Input(shape=[num_classes], name='input_9')
    c10 = Input(shape=[num_classes], name='input_10')
    # c11 = Input(shape=[num_classes], name='input_11')
        # add the condition tensor here.
    x = ConditionalRecurrent(LSTM(num_cells, return_sequences=True, name='cond_rnn_0'))([i,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10])
        # and here too.
    x = ConditionalRecurrent(LSTM(num_cells, return_sequences=False, name='cond_rnn_1'))([x,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10])
    x = Dense(units=num_classes, activation='softmax')(x)
    model = Model(inputs=[i,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10], outputs=[x])

        # Define data.
    test_inputs = np.random.uniform(size=(num_samples, time_steps, input_dim))
    test_con = test_targets = create_conditions(num_samples, num_classes)
    #print(test_con)
    
    model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
    model.fit(verbose=2, x = [test_inputs,test_con,test_con,test_con,test_con
                              ,test_con,test_con,test_con,test_con,test_con,test_con], y=test_targets, epochs=10)

    pred1 = model.predict([test_inputs,test_con,test_con,test_con,test_con
                           ,test_con,test_con,test_con,test_con,test_con,test_con])
    #print(pred1)

num_samples = 10
    input_dim = 1
    num_classes = 3
    time_steps = 10
    num_cells = 6
    
if __name__ == '__main__':
    main()

from cond_rnn.

philipperemy avatar philipperemy commented on August 11, 2024

@hsinyuku oh yeah in the code I put 10 as the max number of conditions. I can increase it to 20.

from cond_rnn.

hsinyuku avatar hsinyuku commented on August 11, 2024

from cond_rnn.

philipperemy avatar philipperemy commented on August 11, 2024

@hsinyuku it's purely arbitrary. I will increase it now. Hang on.

from cond_rnn.

philipperemy avatar philipperemy commented on August 11, 2024

I pushed in in version 3.2.0 ;)

from cond_rnn.

philipperemy avatar philipperemy commented on August 11, 2024

53a23fb

from cond_rnn.

hsinyuku avatar hsinyuku commented on August 11, 2024

A stupid question: How can I get this new version. I am using !pip install in Colab. I re-installed but nothing changed

from cond_rnn.

philipperemy avatar philipperemy commented on August 11, 2024
!pip install --upgrade cond-rnn

should work.

from cond_rnn.

hsinyuku avatar hsinyuku commented on August 11, 2024

I tried first uninstall and install with upgrade as you suggested already. In the log it shows the following. You can see in the last 3 lines that it started by using 3.2.0 and then going back to 3.1.1.
In the end, the installed version is still 3.1.1 when I checked by !pip show cond-rnn

Found existing installation: cond-rnn 3.1.1
Uninstalling cond-rnn-3.1.1:
Would remove:
/usr/local/lib/python3.8/dist-packages/cond_rnn-3.1.1.dist-info/*
/usr/local/lib/python3.8/dist-packages/cond_rnn/*
Proceed (y/n)? y
Successfully uninstalled cond-rnn-3.1.1
Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
Collecting cond-rnn
Using cached cond_rnn-3.2.0-py3-none-any.whl (7.1 kB)
Requirement already satisfied: protobuf<=3.20 in /usr/local/lib/python3.8/dist-packages (from cond-rnn) (3.19.6)
Using cached cond_rnn-3.1.1-py3-none-any.whl

from cond_rnn.

philipperemy avatar philipperemy commented on August 11, 2024

@hsinyuku my bad I think I know why. Give me a few minutes.

from cond_rnn.

hsinyuku avatar hsinyuku commented on August 11, 2024

Success !!! Thank you. I really appreciate your prompt response <3 Thank you also for the great package with clear explanation, example and easy to be used design. Love it.

from cond_rnn.

philipperemy avatar philipperemy commented on August 11, 2024

@hsinyuku Happy to hear that!! Thank you!!

from cond_rnn.

Related Issues (20)

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.