class_docstr: ### Tiny Shakespeare Dataset
code: def __init__(self, seq_len: int):
      # Location of the text file
      path = lab.get_data_path() / "tiny_shakespeare.txt"
      # Download the file
      download_file(
          "https://raw.githubusercontent.com/karpathy/char-rnn/master/data/tinyshakespeare/input.txt",
          path,
      )
      # Read the downloaded file
      with open(str(path), "r") as f:
          text = f.read()
  
      # Extract the characters
      chars = list(set(text))
      # Character to id (integer) map
      self.stoi = {c: i for i, c in enumerate(chars)}
      # Id to character map
      self.itos = {i: c for i, c in enumerate(chars)}
      # Length of a training sample
      self.seq_len = seq_len
      # Data in the form of a tensor of ids
      self.data = self.text_to_i(text)
  
imports: import dataclasses
  import torch
  from labml_helpers.module import Module
  from torch import nn
  from torch.utils.data import Dataset, DataLoader
  from labml import experiment, lab, tracker, monit, logger
  from labml.logger import Text
  from labml.utils.download import download_file
  from labml_nn.experiments.nlp_autoregression import transpose_batch
  from labml_nn.optimizers.noam import Noam
  from labml_nn.transformers import Encoder, MultiHeadAttention
  from labml_nn.transformers.feed_forward import FeedForward
  from labml_nn.transformers.models import EmbeddingsWithPositionalEncoding, TransformerLayer
  from labml_nn.transformers.utils import subsequent_mask
label_desc: Use image node_id 1 to create a new TinyShakespeareDataset object from inherited base classes: Dataset with example: obj = TinyShakespeareDataset(seq_len)