code: def __init__(self, tmpdir, cache, size, num_classes):
      from PIL import Image
  
      self.data = []
      self.cache = cache
  
      seed_everything(42)
  
      for i in range(size):
          path = os.path.join(tmpdir, f"img{i}.jpeg")
          np_data = np.random.randint(
              255, size=(28, 28), dtype=np.uint8
          )
          img = Image.fromarray(np_data).convert("L")
          img.save(path, format="jpeg", quality=100)
          self.data.append(
              {"image": path, "class": np.random.randint(num_classes)}
          )
  
imports: import json
  import os
  import sys
  from functools import partial
  import numpy
  import pytest
  import torch
  from lightning import seed_everything
  from lightning.data.streaming import Cache
  from lightning.data.streaming.dataloader import CacheDataLoader
  from lightning.data.streaming.dataset import StreamingDataset
  from lightning.data.streaming.item_loader import TokensLoader
  from lightning.data.streaming.serializers import Serializer
  from lightning.data.utilities.env import _DistributedEnv
  from lightning.fabric import Fabric
  from lightning.pytorch.demos.boring_classes import RandomDataset
  from lightning_utilities.core.imports import RequirementCache
  from lightning_utilities.test.warning import no_warning_call
  from torch.utils.data import Dataset
label_desc: Use image node_id 1 to create a new ImageDataset object from inherited base classes: Dataset with example: obj = ImageDataset(tmpdir, cache, size, num_classes)