Train. Serve. Deploy! Story of a NLP Model ft. PyTorch, Docker, Uwsgi and Nginx

Quickly prototype a machine translation model from scratch and learn how to serve it in production

Shreya Khurana

Data Science Deep Learning Machine-Learning Natural Language Processing Web Servers and MicroFWs (Flask/Tornado/Nginx/...)

See in schedule Download/View Slides

Natural language processing has seen leaps of technology progress with Machine Learning becoming the norm of solving the major problems in this area, with Machine translation being one of the major problems in this area. Neural machine translation systems are now used to convert sentences or phrases from one language to another, or in general, for sequence to sequence modeling. In this talk, we’ll be covering the steps from scratch to preprocess, train and serve a NMT model using PyTorch. While building a highly accurate model is a prerequisite to getting good quality translations, often in industry, we also need to make sure we can serve the model to customers without getting timeouts or delays. The practice of serving models requires creating a web app to get client requests and process them in a way the model would understand. For this, we’ll use the various components of the application server environment - Flask, Docker, uwsgi and nginx. This talk is suitable for audience who is working in general with ML models and want to learn how to serve them or working specifically with NMT and want to learn about some quick prototyping tips.

Prerequisites: Audience should be comfortable with the basic ML terminology and procedure of training models. NLP knowledge will be good, but is not a necessity as the focus will be on quick prototyping in production.

By the end of the talk, the audience will have:
- Learnt how to preprocess data for NLP systems
- Learnt how to quickly prototype and train a translation model
- Learnt how to create a web app for the NLP model using Flask
- Learnt how to containerize a pytorch model using Docker
- Learnt how to serve the model as an app using uwsgi, nginx and


- Introduction to translation systems, machine translation framework

ML Modelling
- Preprocessing data
- Training
- Generating new translations

Serving and prototyping
- Flask app
- Docker container
- Nginx + uwsgi + supervisord configurations
- Putting it all together

Good practices
Q/A (optional?)

Type: Talk (30 mins); Python level: Intermediate; Domain level: Intermediate

Shreya Khurana


As a data scientist at GoDaddy, Shreya works on language systems, unstructured multilingual text data and builds deep learning models for NLP systems.

Previously, she completed her Masters in Statistics from the University of Illinois at Urbana-Champaign. There she worked on Hierarchical Bayesian models for geo-spatial data and has also delivered a talk at GeoPython 2019 about the same in June 2019:

She also delivered a talk for Women Who Code Python in April 2020 about contextual word embeddings in NLP:

She was also a speaker at PyCon 2020, which was held online, where she spoke on multilingual NLP models: