code: def worker_init_fn(_):
      worker_info = torch.utils.data.get_worker_info()
  
      dataset = worker_info.dataset
      worker_id = worker_info.id
  
      if isinstance(dataset, Txt2ImgIterableBaseDataset):
          split_size = dataset.num_records // worker_info.num_workers
          # reset num_records to the true number to retain reliable length information
          dataset.sample_ids = dataset.valid_ids[
              worker_id * split_size : (worker_id + 1) * split_size
          ]
          current_id = np.random.choice(
              len(np.random.get_state()[1]), 1
          )
          return np.random.seed(
              np.random.get_state()[1][current_id] + worker_id
          )
      else:
          return np.random.seed(np.random.get_state()[1][0] + worker_id)
  
imports: import argparse, os, sys, datetime, glob, importlib, csv
  import numpy
  import time
  import torch
  import torchvision
  import pytorch_lightning
  from packaging import version
  from omegaconf import OmegaConf
  from torch.utils.data import random_split, DataLoader, Dataset, Subset
  from functools import partial
  from PIL import Image
  from pytorch_lightning import seed_everything
  from pytorch_lightning.trainer import Trainer
  from pytorch_lightning.callbacks import ModelCheckpoint, Callback, LearningRateMonitor
  from pytorch_lightning.utilities.distributed import rank_zero_only
  from pytorch_lightning.utilities import rank_zero_info
  from ldm.data.base import Txt2ImgIterableBaseDataset
  from ldm.util import instantiate_from_config
label_desc: Use image node_id 3 for calling a global function with example usage: worker_init_fn(_) and returns: np, np