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-0.8.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: tinyshakespeareloader-0.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-0.8.0.tar.gz
Algorithm Hash digest
SHA256 c8bf5832c262295f722479ad859c222d03b29ddbc22f08243029d2b3b01dcd89
MD5 f1ee6a24f41760cee8a94766c19da1b5
BLAKE2b-256 ff37992acf4e5c3770a509cf775a81204931bc4c6dddfb813d65f43c54441a2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tinyshakespeareloader-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 24dc2a0ac8fdc9adc780f08c5f6a4cc20447fb5f063fb1d48698e77fbdcc752f
MD5 14afcdba0a2af799d5c5b93af90e211c
BLAKE2b-256 088c3e955cd9f5e7c7c85546d701227e542325f504d5779b3dd1e6b7550b19e3

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