code: def on_pretrain_routine_start(self, trainer, pl_module):
      if trainer.global_rank == 0:
          # Create logdirs and save configs
          os.makedirs(self.logdir, exist_ok=True)
          os.makedirs(self.ckptdir, exist_ok=True)
          os.makedirs(self.cfgdir, exist_ok=True)
  
          if "callbacks" in self.lightning_config:
              if (
                  "metrics_over_trainsteps_checkpoint"
                  in self.lightning_config["callbacks"]
              ):
                  os.makedirs(
                      os.path.join(
                          self.ckptdir, "trainstep_checkpoints"
                      ),
                      exist_ok=True,
                  )
          print("Project config")
          print(OmegaConf.to_yaml(self.config))
          OmegaConf.save(
              self.config,
              os.path.join(
                  self.cfgdir, "{}-project.yaml".format(self.now)
              ),
          )
  
          print("Lightning config")
          print(OmegaConf.to_yaml(self.lightning_config))
          OmegaConf.save(
              OmegaConf.create({"lightning": self.lightning_config}),
              os.path.join(
                  self.cfgdir, "{}-lightning.yaml".format(self.now)
              ),
          )
  
      else:
          # ModelCheckpoint callback created log directory --- remove it
          if not self.resume and os.path.exists(self.logdir):
              dst, name = os.path.split(self.logdir)
              dst = os.path.join(dst, "child_runs", name)
              os.makedirs(os.path.split(dst)[0], exist_ok=True)
              try:
                  os.rename(self.logdir, dst)
              except FileNotFoundError:
                  pass
  
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 the SetupCallback obj's underlying member method code with example usage: obj.on_pretrain_routine_start(trainer, pl_module) without return types