Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibility for attention applied only at single layer of MusicRNN. #106

Open
naotokui opened this issue Jul 12, 2018 · 7 comments
Open

Comments

@naotokui
Copy link

Hi,

I've trained a DrumsRNN model with my own drum sequence dataset and been trying to use it with magenta-js. When I load the model, I get errors apparently caused by the differences in the layer structure described in weights_manifest.json. I suspect that it is a compatibility issue.

Which tensorflow version is compatible with magenta-js?

FYI, I used tensorflow 1.4.1 to train the DrumsRNN model.

Thanks

@adarob
Copy link
Contributor

adarob commented Jul 17, 2018

What is the error that you saw?

@naotokui
Copy link
Author

naotokui commented Jul 18, 2018

I have a CodePen sketch based on Tero's amazing Neural Drum Machine.

Every time I tried to generate sequences (sampleRnn()) using my own model, I got this error:

magentamusic.js:45133 Uncaught (in promise) TypeError: Cannot read property 'matMul' of undefined
    at t.sampleRnn (magentamusic.js:45133)
    at magentamusic.js:45098
    at Object.t.tidy (magentamusic.js:12849)
    at t.<anonymous> (magentamusic.js:45088)
    at magentamusic.js:44957
    at Object.next (magentamusic.js:44938)
    at magentamusic.js:44932
    at new Promise (<anonymous>)
    at r (magentamusic.js:44928)
    at t.continueSequence (magentamusic.js:45069)

Then I figured out that my instance of musicRNN class has 0 lstmCells after the initialization (len(this.lstmCells) == 0). I believe it's due to the differences in the network structure described in weights_manifes.json.

Here is the weights_manifes.json of the original DrumsRNN model.
https://gist.github.com/naotokui/847394f037c3481c27600da13a51728a

and this is mine.
https://gist.github.com/naotokui/aa64abf09e748c0d5dbc14d7009731d4

For example, one of the lstm layers in the original model has a name like this: rnn/attention_cell_wrapper/multi_rnn_cell/cell_0/basic_lstm_cell/bias

but in my model, the same layer iss named:
rnn/multi_rnn_cell/cell_0/attention_cell_wrapper/basic_lstm_cell/bias

I suspect this is the cause of this issue.

@adarob
Copy link
Contributor

adarob commented Jul 18, 2018 via email

@naotokui
Copy link
Author

Thank you! here are my checkpoints:
https://www.dropbox.com/sh/84ohnr9ee8yvzvm/AADn70s7HGzcLhQkLAfEaRbna?dl=0

@adarob
Copy link
Contributor

adarob commented Jul 19, 2018 via email

@adarob adarob changed the title compatilibity?? Add compatibility for attention applied only at single layer of MusicRNN. Aug 23, 2018
@mjxmusic
Copy link

hi @adarob - any idea if there was ever a fix implemented for this w/ Magenta.JS?

@adarob
Copy link
Contributor

adarob commented Apr 26, 2022

Sorry. but I am not sure if/when we will have time to fix this on our end. However, we would absolutely accept PR hhat does!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants