HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
minimaxir
gpt-2-simple
Python2019–2025
minimaxir / gpt-2-simple

gpt-2-simple

Python package to easily retrain OpenAI's GPT-2 text-generating model on new texts

10Distinct people
19Mentions
0Explicit recommenders
3.4KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Python package to easily retrain OpenAI's GPT-2 text-generating model on new texts

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 5:04:57 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year19 dated mentions

Observed mentions: 2019-04-19 16:11:20 UTC to 2025-12-14 05:48:43 UTC.

02468102019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 10 mentions; 1 submissions, 9 comments20192020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 6 mentions; 0 submissions, 6 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20222023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2025

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC1019
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC606
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC000
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC101
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC101
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC000
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC101

What Hacker News says

19 sources
In 2020, a friend and I did this with our mutual WhatsApp chat history. Except instead we fine-tuned GPT-2 instead. (As was the fashion at the time!) We used this one, I think https://github.com/minimaxir/gpt-2-simple I think it took 2-3 hours on my friend's Nvidia something. The result was absolutely hilarious. It was halfway between a markov chain and what you'd expect from a very small LLM these days. Completely absurd nonsense, yet eerily coherent. Also, it picked up enough of our personality and speech patterns to shine a very low resolution mirror on our souls... ### Andy: So here's how you get a girlfriend: 1. Start making silly faces 2. Hold out your hand for guys to swipe 3. Walk past them 4. Ask them if they can take their shirt off 5. Get them to take their shirt off 6. Keep walking until they drop their shirt Andy: Can I state
Read the rest
explicitly this is the optimal strategy
In I fed 24 years of my blog posts to a Markov model
Tap the contact's name in WhatsApp (I think it only works on a phone) and at the bottom of that screen there's Export Chat. There was some post-processing needed to get it in this format: Alice: blah John: blah blah Edit: OP's GitHub README has instructions for exporting & preprocessing. --- For finetuning GPT-2 I think we used this thing. I ran it on Google Colab. My friend ran it on his GPU, it should be doable on most modern-ish GPUs. https://github.com/minimaxir/gpt-2-simple I tried doing something with this a few months ago though and it was a bit of a hassle to get running (needed to use a specific python version for some dependencies...), I forget the details sorry!
In Show HN: WhatsApp-Llama: A clone of yourself from your WhatsApp conversations
The GPT-2 weights were released by OpenAI when GPT-2 was released. (https://github.com/openai/gpt-2) Around that time (since no one else was doing it) I released a wrapper to streamline that code and make it much easier to finetune on your own data. (https://github.com/minimaxir/gpt-2-simple) Nowadays, the easiest way to interact with GPT-2 is to use the transformers library (https://github.com/huggingface/transformers), of which I've created a much better library for GPT-2 that leverages it. (https://github.com/minimaxir/aitextgen)
In Does GPT-2 Know Your Phone Number?
If you want to play with your own GPT-2 API, I put this together and shared it on HN yesterday: https://github.com/cortexlabs/cortex/tree/master/examples/py... You can run that and deploy your own GPT-2 API locally, or in the cloud. I'd also recommend checking out Max Woolf's gpt-2-simple, which is a library that makes it really easy to fine tune GPT-2 with your own text (if you've played the free version of AI Dungeon, this is how they trained their model): https://github.com/minimaxir/gpt-2-simple
In Low-code, no-model recommendation system with GPT3
With GPT-3 getting so many people interested in NLP, and with OpenAI's recently announced pricing plan putting it out of many people's reach, I thought it might be useful for some to see how easy it is to deploy your own GPT-2 API. This project uses a couple tools: - Cortex: An open source model serving platform I help maintain. https://github.com/cortexlabs/cortex - Hugging Face's Transformers: An open source library for using popular language models, like GPT-2. https://github.com/huggingface/transformers This project uses a vanilla pre-trained GPT-2 and PyTorch. If you want to use TensorFlow/ONNX, that's supported as well ( https://github.com/cortexlabs/cortex/tree/master/examples/te... ). If you want to finetune GPT-2 on your own text (a la AI Dungeon), I'd suggest using gpt-2-simple and deploying with Cortex: https://github.com/minim
Read the rest
axir/gpt-2-simple Lastly, by following this example, you can deploy your API locally (where inference will probably be slow, depending on your hardware, but will cost you $0) or to a cluster on AWS, which Cortex can spin up/manage for you.
In Show HN: Can't afford GPT-3 access? Self-host your own GPT-2 API
She said it was amazingly beautiful and would have been really moved by it had it not been written by an AI. I counter-argued that human curation of AI generated text was a perfectly valid expression of love. I lost :-|. The model generates results that are formatted like love letters with reasonably structured phrases. Verbatim reproduction of training content seems very low. But the sentences are often nonsensical and there's not much context preservation apart from some repetition. However it does generate some quite interesting original phrases: " Mon âme a moins de conversations que le désir " " C'est une joie bien trop violente pour moi " " vous [êtes] comme l'eau d'un pur amour " These phrases can be cherry-picked based on the feeling you're trying to convey and used to compose unique letters influenced by the best french writers i
Read the rest
n history. Technically: an OpenAI GPT-2 model (117/124M parameters) trained on around 1Gb of french classical litterature was fine-tuned on 300Kb of french love poetry and love songs. We used GPT-2-Simple https://github.com/minimaxir/gpt-2-simple and GPT-2-Cloud-Run https://github.com/minimaxir/gpt-2-cloud-run by Max Woolf. The base french model (GPT2-French) was trained by William Jacques: https://github.com/aquadzn/gpt2-french. We used his "romans" model which is trained using text from https://www.bibebook.com/download, which looks like a compilation of project Gutenberg french novels. His model is trained over 5000 steps. Fine-tuning was done using Max Woolf's Colab notebook: https://colab.research.google.com/drive/1VLG8e7YSEwypxU-noRN... and lasted only 600 steps (less than 30 minutes). Less steps and the content wasn't great, more and it started to reproduce training content verbatim.
In Show HN: I used AI to write my wife a Valentine's day love letter (in French)
For finetuning GPT-2 on custom text, my gpt-2-simple package (https://github.com/minimaxir/gpt-2-simple) gets close to going OOM when finetuning the 345M model, even on a 16GB VRAM server GPU. Doubling the size of the model with the 774M model might cause it to not work at all, so I’ll need to test. Of course, the default output from the model might be sufficient, although it’ll take twice as long to generate text compared to the 345M which is slow even on a GPU. How exactly the large GPT-2 models are deployed is a mystery I really wish was open-sourced more.
In GPT-2: 6-Month Follow-Up
Hey HN! As a side project, I used the GPT-2 OpenAI NLG model and trained it on Donald Trump speeches. You can type a sentence and it will generate a few paragraphs that sound like Trump completing the thought. I used https://github.com/minimaxir/gpt-2-simple and some other stuff to re-train, with Starlette being the python web server. I'll write up a blog post later on what I learned and issues I faced. The text generation is pretty slow right now (~20 secs), but I didn't optimize anything since this was just a fun side project. Would love thoughts/feedbacks/funny texts :-)
In Show HN: Trump to Text (Natural Language Generation)

Showing the 15 most recent of 19 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.