# minimaxir/aitextgen

A robust Python tool for text-based AI training and generation using GPT-2.

Repository: https://github.com/minimaxir/aitextgen
Canonical: https://ross.abutalabs.com/products/aitextgen
Homepage: https://docs.aitextgen.io
Language: Python
License: MIT
License Family: permissive
Last push: 2023-07-14T10:52:26+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 2439, "days_push": 1146, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1838, forks 214 (observed 2026-08-28T04:05:42.818141+00:00)

## What it is
aitextgen is a Python library for training and generating text with GPT-2 and GPT Neo models, built on PyTorch, Hugging Face Transformers, and PyTorch Lightning. It supports finetuning pretrained models or training from scratch, with efficient dataset encoding, merging, and multi-GPU training.

## Use cases
- finetune gpt-2 on my own text dataset
- generate text with a custom-trained language model
- train a small gpt model from scratch
- merge multiple text datasets for language model training
- run gpt-2 text generation on a gpu or colab notebook

## When to choose
- you want a simple, high-level API for GPT-2/GPT Neo finetuning and text generation
- you need compatibility with Hugging Face Transformers for downstream NLP tasks
- you want to train on CPU, single GPU, or multiple GPUs with PyTorch Lightning

## When to avoid
- you need modern LLM architectures like Llama or Mistral, which it does not support
- you need large-scale distributed training or the latest training techniques
- you want actively developed features; the project has seen limited recent updates

## Facets
- artifact type: library
- maturity: maintenance
- function: llm-training, nlp, machine-learning
- domain: large-language-models, machine-learning
- platform: python, cross-platform
- tags: gpt-2, text-generation, pytorch, huggingface-transformers, finetuning, pytorch-lightning, natural-language-processing, gpu

## Member repositories
- minimaxir/aitextgen (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:42.818141+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:18:17.101209+00:00, confidence not recorded.
  - readme: https://github.com/minimaxir/aitextgen (fetched 2026-08-28T04:05:42.818141+00:00, sha dddf06fd95d4)
  - registry_pypi: https://pypi.org/pypi/aitextgen/json (fetched 2026-08-29T10:57:43.257137+00:00, sha 8fb173d5d297)
- Data as of 2026-08-30T08:39:29.467469+00:00.
