Sign in

James Briggs

What’s new, and what’s next?

Image for post
Image for post
Photo by Fábio Lucas on Unsplash

The full release of Python 3.9 is out!

It’s clear that this version marks a breaking point from the old route of Python’s evolution, onto a new path. We’ll cover:

Let’s explore these new features and understand where Python is heading.

Python’s New Path

There are two significant changes in this update, which we won’t see any immediate impact from — but we will begin to notice a slightly different evolution of Python as a language.

In short, this boils down…


An intuitive visual guide to comprehending cutting-edge NLP

Image for post
Image for post
Photo by Johannes Plenio on Unsplash

GPT-3, BERT, XLNet, all of these are the current state of the art in natural language processing (NLP) — and all of them use a special architecture component called a Transformer.

Without a doubt, transformers are one of the biggest developments in AI in the past decade — bringing us ever closer to the unimaginable future of humanity.

Nonetheless, despite their popularity, transformers can seem confusing at first. Part of this seems to be because many ‘introductions’ to transformers miss the context that is just as important as understanding the transformer model architecture itself.

How can anyone be expected to grasp the concept of a transformer without first understanding attention and where attention came from? …


All you need to know

Image for post
Image for post

*All images used are by the author except where stated otherwise

Regular expressions are the de facto standard for parsing text. Every reputable programming language supports them, and almost every developer will need to use them at some point — they’re important.

The point of this article is to introduce regular expressions and work all the way through to some of the most interesting (and more advanced) features in RegEx — like look-ahead/behind assertions and conditionals.

If none of this had made any sense to you — don’t worry — we will start from the beginning.


Automate your tasks easily with cron

Pocket watch
Pocket watch
Photo by Jiyeon Park on Unsplash.

Scheduling scripts can be an absolute necessity for a huge number of tasks. From data collection for AI to weekly blog newsletters, schedules are absolutely everywhere.

A significant portion of schedulable jobs is hosted on Linux machines and operated by Python scripts. Today, we will take a look at how we can automate script schedules using cron in Linux.

Note: The examples used here are specific to Fedora distributions (specifically CentOS). However, the process (minus the cron installation) is essentially the same for most other popular distributions as far as I am aware.

If something isn’t the same, let me know in the comments and I can update the article for others. …


A full API walkthrough using FastAPI, Gunicorn, Nginx, and CentOS

Image for post
Image for post
Photo by Philipp Katzenberger on Unsplash

The web runs on Linux, and we are currently living in the age of APIs. These two facts alongside Python being the most popular programming language in the world make knowing how to deploy a Python API via Linux an invaluable skill.

API development in Python is typically regulated to Django, Flask, or FastAPI, alongside a few other frameworks. The fastest of those for API development is the fittingly named FastAPI library.

In this article, we will produce a simply API with FastAPI — and learn how to deploy it on a Linux webserver (CentOS) using Uvicorn, Gunicorn, systemd, and (optionally) NGINX. …


A rundown of the best new features added to Python 3.7–3.9

Image for post
Image for post
Photo by Yancy Min on Unsplash

2018 brought us a plethora of new features with the release of Python 3.7, followed by 3.8 in 2019, and 3.9 in 2020.

Many of those changes were behind the scenes. Optimizations and upgrades that the vast majority of us will never notice, despite their benefits.

Others are more obvious, additions to syntax or functionality that can change how we write our code. But even these visible changes can be hard to keep up with.

In this article, we will run through the more apparent upgrades to provide a brief but hopefully invaluable refresher on everything new to Python from the past few years. …


The full starter’s guide to open-source MySQL

Image for post
Image for post
Photo by SwapnIl Dwivedi on Unsplash

For anyone working with data (which — last I heard — is everyone), SQL is one of those skills that truly can move mountains. If SQL is used in your workplace, learning it can dramatically change your career for the better.

Although it is used everywhere, it can be expensive too. Many companies I’ve worked at or with used one of the following:

  • Microsoft’s SQL Server
  • Oracle DBMS
  • IBM DB2

None of these are open-source, and all come with a hefty price tag. …


How to use cutting-edge NLP in text summarization

Colored lights in the shape of letters spelling out Google.
Colored lights in the shape of letters spelling out Google.
Photo by Mitchell Luo on Unsplash

Automatic text summarization allows us to shorten long pieces of text into easy-to-read, short snippets that still convey the most important and relevant information of the original text.

In this article, we’ll build a simple but incredibly powerful text summarizer using Google’s T5. We’ll be using the PyTorch and Hugging Face’s Transformers frameworks.

This is split into three parts:

Check out the video version of this article here:

Imports and Initialization

We need to import PyTorch and the AutoTokenizer and AutoModelWIthLMHead objects from the Transformers library:


Learn how to use Google’s ML titan

Image for post
Image for post
Photo by Taylor Smith on Unsplash

TensorFlow is one of the two titan frameworks in machine learning and data science. To operate effectively in either field, you need to become very familiar with TensorFlow or PyTorch — preferably both.

We will be focusing on the basics of TensorFlow in this article — there are no prerequisites other than an appetite to learn.

To be more specific, we will be speaking primarily about the high-level wrapper that we can call Keras. If you don’t know what that means, you will soon.

We will cover:


How to apply cutting-edge language generation in Python

Image for post
Image for post
Photo by Reina Kousaka on Unsplash

Language generation is one of those natural language tasks that can really produce an incredible feeling of awe at how far the fields of machine learning and artificial intelligence have come.

GPT-1, 2, and 3 are OpenAI’s top language models — well known for their ability to produce incredibly natural, coherent, and genuinely interesting language.

In this article, we will take a small snippet of text and learn how to feed that into a pre-trained GPT-2 model using PyTorch and Transformers to produce high-quality language generation in just eight lines of code. We cover:

About

James Briggs

Data scientist learning and writing about everything.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store