Code needs updating

#5
by jchwenger - opened

Hello @karpathy , it looks liks the use of a script is no longer supported in recent versions of datasets, and instead the repo needs to be the data itself. Given how popular (and lovely) your Tiny Shakespeare is, it would be nice to offer the community a version that works again?

I'll do dome digging to see how easy it is to convert things, and I can see there's many forks already, but at the end of the day I'm sure most people will want to try yours first (I use it in a course of mine <3).

Hi again @karpathy , thankfully the update procedure is extremely simple: downgrade the library to 3.6.0, then run:

from datasets import load_dataset
from pathlib import Path

dataset = load_dataset("tiny_shakespeare.py")

train_text = dataset["train"][0]["text"]
val_text = dataset["validation"][0]["text"]
test_text = dataset["test"][0]["text"]

out_dir = Path(".")
(out_dir / "train.txt").write_text(train_text, encoding="utf-8")
(out_dir / "validation.txt").write_text(val_text, encoding="utf-8")
(out_dir / "test.txt").write_text(test_text, encoding="utf-8")

Then remove tiny_shakespeare.py, and that's it.

I saved this in my fork, as well as a tiny update to the readme.

As mentioned, given how well-known your dataset is, it would be lovely for the community if your version could be updated some day : ).

Sign up or log in to comment