Finetune documentation

Finetune is a python library designed to make finetuning pre-trained language models for custom natural language processing tasks a breeze.

It ships with pre-trained model weights from “Improving Language Understanding by Generative Pre-Training” and builds off the OpenAI/finetune-language-model repository.

Source code for finetune is available on github.


Finetune can be installed directly from PyPI by using pip

pip install finetune

or installed directly from source:

git clone
cd finetune
python3 develop

You can optionally run the provided test suite to ensure installation completed successfully.


Finetune Quickstart Guide

Finetuning the base language model is as easy as calling

model = LanguageModelClassifier()   # load base model, trainY)           # finetune base model on custom data
predictions = model.predict(testX)  # predict on unseen examples                    # serialize the model to disk

Easily reload saved models from disk by using LanguageModelClassifier.load():

model = LanguageModelClassifier.load(path)
predictions = model.predict(testX)

Finetune API Reference