Skip to main content

Toy-GPT: train-300-context-2

PyPI version Latest Release Docs License: MIT CI Deploy-Docs Check Links Dependabot

Demonstrates, at very small scale, how a language model is trained.

This repository is part of a series of toy training repositories plus a companion client repository:

  • Training repositories produce pretrained artifacts (vocabulary, weights, metadata).
  • A web app loads the artifacts and provides an interactive prompt.

Contents

  • a small, declared text corpus
  • a tokenizer and vocabulary builder
  • a simple next-token prediction model
  • a repeatable training loop
  • committed, inspectable artifacts for downstream use

Scope

This is:

  • an intentionally inspectable training pipeline
  • a next-token predictor trained on an explicit corpus

This is not:

  • a production system
  • a full Transformer implementation
  • a chat interface
  • a claim of semantic understanding

Outputs

This repository produces and commits pretrained artifacts under artifacts/.

Training logs and evidence are written under outputs/ (for example, outputs/train_log.csv).

Quick start

See SETUP.md for full setup and workflow instructions.

Run the full training script:

uv run python src/toy_gpt_train/d_train.py

Run individually:

  • a/b/c are demos (can be run alone if desired)
  • d_train produces artifacts
  • e_infer consumes artifacts
uv run python src/toy_gpt_train/a_tokenizer.py
uv run python src/toy_gpt_train/b_vocab.py
uv run python src/toy_gpt_train/c_model.py
uv run python src/toy_gpt_train/d_train.py
uv run python src/toy_gpt_train/e_infer.py

Provenance and Purpose

The primary corpus used for training is declared in SE_MANIFEST.toml.

This repository commits pretrained artifacts so the client can run without retraining.

Annotations

ANNOTATIONS.md - REQ/WHY/OBS annotations used

Citation

CITATION.cff

License

MIT

SE Manifest

SE_MANIFEST.toml - project intent, scope, and role

Metadata

Release files for toy-gpt-train-300-context-2 0.9.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for toy-gpt-train-300-context-2 0.9.8
File Size Uploaded
toy_gpt_train_300_context_2-0.9.8.tar.gz 86.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for toy-gpt-train-300-context-2 0.9.8
File Interpreter ABI Platform
toy_gpt_train_300_context_2-0.9.8-py3-none-any.whl Python 3 none any Details

Total release size: 112.6 kB

Release files / toy_gpt_train_300_context_2-0.9.8.tar.gz

Download URL toy_gpt_train_300_context_2-0.9.8.tar.gz
Size 86.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cb11975dba42a5cb5e3f68dc5399abcac60a5b06549b89623b6f41b8ec9ec1d8
BLAKE2b-256 checksum
How to use checksums
b6eb56681ea98ad4a6c7b999469aa340f333d481aee182cc4428cd5796f36cb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 3, 2026.

Transparency log

Release files / toy_gpt_train_300_context_2-0.9.8-py3-none-any.whl

Download URL toy_gpt_train_300_context_2-0.9.8-py3-none-any.whl
Size 26.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d5f787a071460c5291d7433e08943159f8772a01dc53cd4f5d6d0ec3f5b5462
BLAKE2b-256 checksum
How to use checksums
c24336f99dc5e2eef91b80582db956dce9bebdfb8b78790ea1c59d185341cc8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.9.8 This release

2 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page