NLP & MLOps · 2022

From sentiment model to deployable service.

Classifying IMDb movie reviews with a transformer-based model, while exploring the engineering practices needed to organise data, package models and serve predictions outside a notebook.

A model is only part of the product.

Recognising whether a written review expresses positive or negative sentiment is a familiar natural language processing task. The more interesting challenge here was taking it through a structured machine learning lifecycle.

As part of a team project for DTU's Machine Learning Operations course, we explored how to organise training data, work with a pretrained transformer model, and make the result available through a repeatable, containerised workflow.

From reviews to reproducible inference.

The original repository documents a workflow spanning model training and operational tooling, not just a classification notebook.

Prepare labelled reviews

Use IMDb sentiment data described in the repository as 25,000 training reviews and 25,000 evaluation reviews.

Adapt a pretrained transformer

Apply transfer learning with Hugging Face Transformers and BERT-family architectures for binary classification.

Package and serve predictions

Explore DVC for dataset management, Python tests, Docker packaging and Google Cloud-based container images.

Example from the project README · local inference

curl localhost:8080/predictions/distilbert -T review.txt

Run the prediction service locally before using this command.

An end-to-end learning experience.

Transformer-based sentiment classification

The project used the Hugging Face framework for positive-versus-negative review classification with BERT-family models.

Packaging beyond a notebook

The repository documents Docker-based training and deployment images, including a local HTTP interface for text inference.

Reproducibility as a design concern

The project structure uses versioned data tooling, a defined Python package layout and tests to make experimentation more systematic.

Engineering matters after training.

This was an early, collaborative look at the gap between an ML experiment and software someone else can run. Data lineage, repeatable environments, testing and serving are as important to discuss as a model architecture.

That perspective still informs how I approach practical AI systems today: focus on what must work reliably around the model, not only on the model itself.

Explore the project.

The team repository contains implementation details, setup instructions and deployment examples.

View source code ↗