ml5js / ml5-library

Friendly machine learning for the web! 🤖
https://ml5js.org
Other
6.45k stars 905 forks source link

Error sampling pi index in SketchRNN on mobile devices #299

Open KokoDoko opened 5 years ago

KokoDoko commented 5 years ago

Nature of issue

SketchRNN error on mobile devices. When calling model.generate(), I get this error:

error sampling pi index

This also happens when browsing the ml5js.org example, so I don't think it's a problem in my own code.

Browser

iPhone 8, iOS 11, Safari and Chrome

Steps to reproduce

let model

function loadModel(m) {
    model = ml5.SketchRNN(m, modelReady)
}

function modelReady() {
    model.reset()
    model.generate(receivedStroke)
}

function receivedStroke(err, s) {
    console.log(err) // error sampling pi index
}
kylemcdonald commented 5 years ago

I'm seeing the same behavior with another RNN trained on text on mobile. The behavior is completely different than on desktop, both on Android and on iOS with Safari. In some cases it works (doesn't cause an error) but in all cases it generates unreasonable output.

shiffman commented 5 years ago

Hello! Does the magenta demo produce the same error? (https://magenta.tensorflow.org/assets/sketch_rnn_demo/index.html) This is we are relying on for ml5.sketchRNN().

pimdewit commented 4 years ago

It does @shiffman

bomanimc commented 3 years ago

Thanks for opening this issue! A test in 2021 seems to indicate that this issue has been addressed in the Magenta codebase, so I think we can correct the issue in ml5.js by updating to a more recent version of the magenta/sketch. We are currently on 0.2.0.

Edit: Ahh it actually looks like 0.2.0 is the most recent version (from about 2 years ago: https://www.npmjs.com/package/@magenta/sketch. It looks like we'll need a bit more debugging to understand the issue.