This is a character level sequence-to-sequence model for neural machine translation (english to french).
Sequence to sequence model is widely used in research papers, but it is hard to find code about it on how to build one with keras. I found a good resource these days, and tried to understand and rewrote the code.
- Prepare data for encoder and decoder.
- Build a encoder-decoder model for training (teacher forcing).
- Build another model for inference.
- Testing Note: For layer reusing, we need to define a Functional model.
Input sentence: Many fish died.
Decoded sentence: L'aidenu en laume.
Input sentence: This is silly.
Decoded sentence: C'est simple.
Input sentence: We can meet.
Decoded sentence: Nous pouvons le saiver.
Input sentence: Who cares?
Decoded sentence: Qui s'en soucie ?
Input sentence: Did I say that?
Decoded sentence: Ai-je dit cela ?
Input sentence: They're early.
Decoded sentence: Elles sont en avance.
Input sentence: He also saw it.
Decoded sentence: Il l’a aussi vu.
Input sentence: Bring him to me.
Decoded sentence: Apportez-le-moi.
Input sentence: Bottoms up!
Decoded sentence: Santé !
Input sentence: I'm not sad.
Decoded sentence: Je ne suis pas sourde.
https://blog.keras.io/a-ten-minute-introduction-to-sequence-to-sequence-learning-in-keras.html
https://jovianlin.io/keras-models-sequential-vs-functional/