ml5js / ml5-library

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

Examples for CharRNN seem to be broken #1243

Open mross1080 opened 2 years ago

mross1080 commented 2 years ago

Hello!

I'm trying to use the examples for CharRNN as linked to in the ml5 documentation. All the examples seem to throw the same error when starting up.

https://editor.p5js.org/ml5/sketches/CharRNN_Text_Stateful https://editor.p5js.org/ml5/sketches/CharRNN_Interactive

Error: Not found variable rnnlm/multi_rnn_cell/cell_0/basic_lstm_cell/kernel
    at undefined:207:41875

I tried running the editor scripts in both Google Chrome and Firefox. Not sure what steps I can take to fix as it's the examples from the documentation.

Thanks!

tlsaeger commented 2 years ago

Hi @mross1080, thanks for reporting that. I/we will look into the issue.

tlsaeger commented 2 years ago

Hey @mross1080 I did some testing and I think it is an issue with the p5 web editor. I tried to upload a new model from the examples (https://github.com/ml5js/ml5-data-and-models/tree/main/models/charRNN) to make sure its not the model. The new model could not be uploaded, because some file types are not supported. See screenshots attached: Screenshot 2021-10-29 at 23 09 29 This could also be the reason for your issue and would explain that the »at undefined:207:41875«

It works if you are using a p5.js version locally etc. Hope this helps?!

@bomanimc should we take down this example or open an issue with the web-editor?

shiffman commented 2 years ago

Hey @tlsaeger! I wonder if there's a way we could remove just the links to the web editor versions of these examples and add a note of documentation on the charRNN page? I'm also tagging @catarak regarding the web editor! Cassie, do you think it makes sense for the editor to support these tensorflow.js model file types or is that opening too big of a can of worms?

tlsaeger commented 2 years ago

@shiffman i think the removing and making a note would be best. If Cassie and the team support this in the future we could take them back online.

mross1080 commented 2 years ago

Hey @tlsaeger that's totally cool! I would just appreciate some clarity around what is the correct version of things in the docs since I usually point my students towards there. I've found some of the other examples on the site are broken. For example this style transfer video one.

https://editor.p5js.org/ml5/sketches/StyleTransfer_Video

I think it's fine for the library to not work in the p5 editor, but I think it would be helpful to remove links to broken sketches and explicitly tell people they need to run locally. Thanks!

tlsaeger commented 2 years ago

@mross1080 You are 100% right we will remove those links and replace them with an explanation of why they need to be run locally. Gonna take a look at the other example as well. Thanks again for pointing this out! Cheers PS If you find any other broken examples please report them via issues, thanks!

tlsaeger commented 2 years ago

@mross1080 if you like to change the documentation yourself and contribute to the repo, I would be more than happy to assist you. I could also do it myself, what do you think?

catarak commented 2 years ago

Thanks for tagging me on this! What are the file types that need to be supported to get this example working? It's honestly not hard to whitelist file types/MIME types, I just prefer to do it on a case by case basis.

tlsaeger commented 2 years ago

@catarak they weirdly don't have a real file-extension. I've attached a screenshot, maybe you know what kind of file that is:

Screenshot 2021-11-02 at 17 46 11

The JSON files do work of course.

catarak commented 2 years ago

Hmm I don't know what the mime type is either! Maybe these files could be whitelisted based on their names? The trained model files all have the same names, right?

shiffman commented 2 years ago

Correct! these names are generated by the training process so this would work well! (Could it be exploited in any way?) We could also investigate changing the way the training works to add file extensions. My guess is that these are all "binary data" files. Happy to investigate if that would be helpful.