Skip to main content

No project description provided

Project description

TinyShakespeareLoader

A PyTorch DataLoader for the TinyShakespeare Dataset

If you followed Andrej Karparthy's tutorial on GPT, you will notice he used the TinyShakespeare dataset, but not with the PyTorch DataLoader. This repository fills that gap.

The TinyShakespeare dataset is a small dataset of Shakespeare's plays, with each line as a separate sample. To install this package, simply run:

    pip install TinyShakespeareLoader

Then, to use it, simply import it and use it as a PyTorch DataLoader:

    from TinyShakespeareLoader.hamlet import get_data


    tinyshakespeare = get_data()

    train_dataloader, test_dataloader = tinyshakespeare.train_dataloader, tinyshakespeare.test_dataloader

    for batch in train_dataloader:
        print(batch)

You can provide your own encoder function if you want - but it's not required! If you don't, it will just simply use the character level encoding, that Andrej also used in his tutorial.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tinyshakespeareloader-1.8.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

tinyshakespeareloader-1.8.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file tinyshakespeareloader-1.8.0.tar.gz.

File metadata

  • Download URL: tinyshakespeareloader-1.8.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.12 Darwin/23.0.0

File hashes

Hashes for tinyshakespeareloader-1.8.0.tar.gz
Algorithm Hash digest
SHA256 ad7d0034565cea35b3cc365c598c10cd86de498e3e2278c37123f1e1a0f27bec
MD5 243a4d14e48473ccd924c50517f308b7
BLAKE2b-256 ee22c13117b12053bdaf703556b362ebf37186c203c1def8af3085bd3b92d5c0

See more details on using hashes here.

File details

Details for the file tinyshakespeareloader-1.8.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tinyshakespeareloader-1.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6507be6bafda790221ab11409ebe8410265ece87492e816ba09e82b5b8d53e84
MD5 5d2c2e3d7865d13bb5b8e181d8ad726f
BLAKE2b-256 bc629931de0a33e52678f0cce68e480dee94de8cb211b81f0707c8595254f51a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page