Skip to main content

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.

Metadata

Release files for tinyshakespeareloader 1.8.0

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

Source distribution (sdist)

Source distribution for tinyshakespeareloader 1.8.0
File Size Uploaded
tinyshakespeareloader-1.8.0.tar.gz 3.3 kB Details

Built distribution (wheel)

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

Total release size: 7.3 kB

Release files / tinyshakespeareloader-1.8.0.tar.gz

Download URL tinyshakespeareloader-1.8.0.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ad7d0034565cea35b3cc365c598c10cd86de498e3e2278c37123f1e1a0f27bec
BLAKE2b-256 checksum
How to use checksums
ee22c13117b12053bdaf703556b362ebf37186c203c1def8af3085bd3b92d5c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.12 Darwin/23.0.0

Release files / tinyshakespeareloader-1.8.0-py3-none-any.whl

Download URL tinyshakespeareloader-1.8.0-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6507be6bafda790221ab11409ebe8410265ece87492e816ba09e82b5b8d53e84
BLAKE2b-256 checksum
How to use checksums
bc629931de0a33e52678f0cce68e480dee94de8cb211b81f0707c8595254f51a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.12 Darwin/23.0.0

Release history Release notifications | RSS feed

This release

1.8.0 This release

2 release files

1.0.7

2 release files

1.0.5

2 release files

1.0.2

2 release files

1.0.1

2 release files

0.8.0

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