This demo shows how to perform sequence-to-sequence prediction using the Layers API of TensorFlow.js.
It demonstrates loading a pretrained model hosted at a URL, using
tf.loadLayersModel()
The training data was 149,861 English-French sentence pairs available from http://www.manythings.org/anki.
To train the demo in JavaScript, do
yarn train "${DATA_PATH}"
To monitor the loss values during training, use the --logDir
flag
in conjuction with TensorBoard, e.g.,
yarn train "${DATA_PATH}" --logDir /tmp/translation-logs
In a separate terminal, start tensorboard
pip install tensorboard # Unless tensorboard is already installed
tensorboard --logdir /tmp/translation-logs
The model was trained in Node.js with Tensorflow.js, which the model code is converted from Python to TypeScript by @huan based on the translation.py example.
python python/translation.py ${DATA_PATH}
The model was trained in Python Keras, based on the lstm_seq2seq example.
To launch the demo, do
yarn
yarn watch