RNN and LSTMs (Long Short Term Memory networks) are a type of
Neural Network architecture useful for working with sequential data (like characters in text or the musical notes of a song) where the order of the that sequence matters. This class allows you run a model pre-trained on a body of text to generate new text.
Quickstart :
// Create the character level generator with a pre trained model
const rnn = ml5.charRNN('models/bolaño/', modelLoaded);
// When the model is loaded
function modelLoaded() {
console.log('Model Loaded!');
}
// Generate content
rnn.generate({ seed: 'the meaning of pizza is' }, (err, results) => {
console.log(results);
});
Usage :
Initialize
const charrnn = ml5.charRNN(model, ?callback);
Parameters :
* model : REQUIRED. An absolute or relative path to the charRNN model files.
* callback : OPTIONAL. A callback to be called once the model has loaded. If no callback is provided, it will return a promise that will be resolved once the model has loaded.