Skip to content

Latest commit

 

History

History
 
 

translation

TensorFlow.js Example: Sequence-to-Sequence English-French Translation

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()

Training Demo

The training data was 149,861 English-French sentence pairs available from http://www.manythings.org/anki.

JavaScript/TypeScript Version

To train the demo in JavaScript, do

yarn train ${DATA_PATH}

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 Version

python python/translation.py ${DATA_PATH}

The model was trained in Python Keras, based on the lstm_seq2seq example.

LANCH DEMO

To launch the demo, do

yarn
yarn watch

See this example live!