Skip to main content

YogGoPoTh - learning Transformers with the Cthulhu Mythos!

There it was the once I had disglard of that as a daper and cristantent, the tant me trurry that years tabs is deark from a small Noth-eyirly dub to that for the eyard both the land to himself horry bowledge the nolight.

— ygpt-0.1-32-64

My eyes of the infinite basement raised me for the distant corridor. When it could not have to retain, I saw it pass that the ship gave me several actions so even that the curse would never shudder. It seemed something in amused already inside and reality as in my training feet, and myself. That fiendish galley of the gods had burnt a paper of north American in the older trees of Arkham.

— ygpt-0.1-big

Intro

This is a simple implementation of a Transformer encoder model for text generation, based on Andrej Karpathy's "Let's build GPT" video https://www.youtube.com/watch?v=kCc8FmEb1nY&t=970s. While it can be trained on any text, I used the Lovecraft Cthulhu Mythos corpus for training, which made the not-quite-English outputs it produces very fitting (and a bit disturbing).

Usage

Installation

  1. Create a virtual environment and activate it
  2. Install the package into the environment with make install (or make install-dev to install in the editable mode)

Training

  1. Download the Cthulhu Mythos corpus from https://www.hplovecraft.com/writings/texts/. Cleaning and concatenating the texts is left as an exercise to the reader.
  2. Train the model with python -m yoggopoth train path/to/corpus.txt -s path/to/save/model

The training produces two files: model.pth with the saved model and model.vocab with the vocabulary.

The hyperparameters can be adjusted by passing them as the -p argument, e.g. python -m yoggopoth train path/to/corpus.txt -s path/to/save/model -p '{"n_layers": 4, "n_heads": 8}'. The full list of parameters can be found in yoggopoth/settings.py.

Full help available by running python -m yoggopoth train -h.

Generation

  1. Generate text with python -m yoggopoth gen path/to/model

Optional parameters: -f to set the initial text, -t to set the length of the generated text, --stream to enable streaming output (default), --nostream to disable.

Full help available by running python -m yoggopoth gen -h.

Metadata

Release files for yoggopoth 0.0.2

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

Source distribution (sdist)

Source distribution for yoggopoth 0.0.2
File Size Uploaded Provenance
yoggopoth-0.0.2.tar.gz 9.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for yoggopoth 0.0.2
File Interpreter ABI Platform
yoggopoth-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 17.6 kB

Release files / yoggopoth-0.0.2.tar.gz

Download URL yoggopoth-0.0.2.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ae28a6fa2aad7220483370f402acac52fb7506db2b0237e310005133b2e43ec0
BLAKE2b-256 checksum
How to use checksums
e200b9533a5724dfa58419d3787c6aa667e18f0c6173af9114179dbd4c9d6035
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.5

Release files / yoggopoth-0.0.2-py3-none-any.whl

Download URL yoggopoth-0.0.2-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cca333d2c1a237447e8359c02e0d6a1791cef327012f871bbd51bcad2ab29c87
BLAKE2b-256 checksum
How to use checksums
3070c33beb36289d824e61b29ec90fdffc9c8b2700982db6de60fb7094288cb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.5

Security for yoggopoth 0.0.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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