Icon

01_​Training_​a_​Neural_​Machine_​Translation_​Model

Neural Machine Translation from English to German: Training Workflow

This workflow trains a neural machine translation model on character level using an encoder-decoder LSTM network.

The encoder network reads the input sentence character by character and summarizes the sentence in its state. This state is then used as initial state of the decoder network to produce the translated sentence one character at a time. During prediction, the decoder also recieves its previous output as input to the next time. For training we use a technique called "teacher forcing" i.e. we feed the actual previous character instead of the previous prediction which greatly benefits the training.

This example is an adaptation of the following Keras blog post to KNIME: https://blog.keras.io/a-ten-minute-introduction-to-sequence-to-sequence-learning-in-keras.html

Defining the network structure Pre Processing and Encoding Train and Edit Network Apply and Evaluate Network Save Encoder and Decoder Decoder network Encoder network Read bilingualsentences pairsdeu-engUse onlyfirst 10k rowsOpen the learnerview to see how thelearning proceeds.Input size: ?,dictionary sizesource languageInput size: ?,dictionary size target languageSave DecoderSave EncoderActivation Softmaxreturn sequencesand cell stateReturn cell stateextract encoderextract decoderRead EncoderRead Decoder File Reader Row Sampling Partitioning Keras NetworkLearner Keras Input Layer Keras to TensorFlowNetwork Converter Keras to TensorFlowNetwork Converter Evaluation Keras Input Layer TensorFlowNetwork Writer TensorFlowNetwork Writer Keras Dense Layer Keras LSTM Layer Keras LSTM Layer DL PythonNetwork Editor DL PythonNetwork Editor NMT Predictor Index encoding andsequence creation TensorFlowNetwork Reader TensorFlowNetwork Reader Defining the network structure Pre Processing and Encoding Train and Edit Network Apply and Evaluate Network Save Encoder and Decoder Decoder network Encoder network Read bilingualsentences pairsdeu-engUse onlyfirst 10k rowsOpen the learnerview to see how thelearning proceeds.Input size: ?,dictionary sizesource languageInput size: ?,dictionary size target languageSave DecoderSave EncoderActivation Softmaxreturn sequencesand cell stateReturn cell stateextract encoderextract decoderRead EncoderRead Decoder File Reader Row Sampling Partitioning Keras NetworkLearner Keras Input Layer Keras to TensorFlowNetwork Converter Keras to TensorFlowNetwork Converter Evaluation Keras Input Layer TensorFlowNetwork Writer TensorFlowNetwork Writer Keras Dense Layer Keras LSTM Layer Keras LSTM Layer DL PythonNetwork Editor DL PythonNetwork Editor NMT Predictor Index encoding andsequence creation TensorFlowNetwork Reader TensorFlowNetwork Reader

Nodes

Extensions

Links