While working with a Stanford PhD student to do work in Natural Language Processing, I was pointed to a paper that outlines a lightweight model which very effectively translates between languages. The average size for the saved weights of TensorFlow models are only about 5KB. Suddenly, it hit me--what if someone could download translation capability on their phone, so that they can translate offline? This is crucial for when you're in another country and don't have access to WiFi or a cellular network, but need to communicate with a local. This is the most common use case for translators, yet there's no solution available. Thus, Offline Translate was born!

What it does

The app allows you to use it online just like any other translating app, using Google Cloud ML to serve the desired TensorFlow model. Then, when you know you're going to a country where you don't have internet access, you can download the specific language-to-language translator onto your device for translation anytime, anywhere!

How I built it

The Neural Net is a Python-implemented TensorFlow encoder-decoder RNN which takes a variable-length input sequence, computes a representation of the phrase, and finally decodes that representation into a different language. Its architecture is based on cutting-edge, specifically this paper: I extended the TensorFlow Sequence-to-Sequence (seq2seq) library to work effectively for this specific whitepaper. I also started building a custom Long Short-Term Memory Cell which computes the representation in the RNN, in order to adhere to the mathematics proposed in the whitepaper. The app mockup was made using a prototyper, in order to communicate the concept effectively.

Challenges I ran into

The biggest problems I ran into were ML-related issues. TensorFlow is still a bit tricky when it comes to working with variable-length sequences, so it was difficult wrangling the seq2seq library to work for me (specifically by having to extend it).

Accomplishments that I'm proud of

I'm very proud that I was able to actually extend the seq2seq library and get a very difficult concept working in just 36 hours. I'm also proud that I have a clear path of development next-steps in order to get this fully function. I'm happy that I got this whole project figured out in such a short amount of time!

What I learned

The big thing: it is possible to make rigid TensorFlow libraries to work for you. The source code is flexible and portable, so it's not difficult to mixed pre-packaged functionality with personal implementations. I also learned that I can function much better than I thought I could on just 2 hrs of sleep.

What's next for tf-rnn-encoder-decoder

The immediate next step is to get inference work 100% correctly. Once that is done, the technology itself will be solid. Next will be to turn the mockup of the app into a working app, allowing the users to download their preferred models onto their phone and translate anytime, anywhere!

Built With

Share this project: