code: def __post_init__(self):
      if self.max_parallel_models <= 0:
          self.max_parallel_models = self.n_folds
  
      # argument checks
      if len(self.weights) > 1 and len(self.weights) != self.n_folds:
          raise Exception(
              "Either no, one or n_folds (={}) models are required for pretraining but got {}.".format(
                  self.n_folds, len(self.weights)
              )
          )
  
      if len(self.single_fold) > 0:
          if len(set(self.single_fold)) != len(self.single_fold):
              raise Exception("Repeated fold id's found.")
          for fold_id in self.single_fold:
              if fold_id < 0 or fold_id >= self.n_folds:
                  raise Exception(
                      "Invalid fold id found: 0 <= id <= {}, but id == {}".format(
                          self.n_folds, fold_id
                      )
                  )
  
      # by default, the temporary files will be deleted after a successful training
      # if you specify a temporary dir, you can easily resume to train if an error occurred
      if self.keep_temporary_files and not self.temporary_dir:
          raise ValueError(
              "If you want to keep the temporary model files you have to specify a temporary dir"
          )
  
imports: import inspect
  import json
  import logging
  import multiprocessing
  import os
  import sys
  import tempfile
  from copy import deepcopy
  from dataclasses import dataclass, field
  from subprocess import check_call
  from typing import Optional, List
  from paiargparse import pai_dataclass, pai_meta
  from tfaip.util.tfaipargparse import post_init
  from calamari_ocr.ocr import CrossFold, SavedCalamariModel
  from calamari_ocr.ocr.dataset.datareader.hdf5.reader import Hdf5
  from calamari_ocr.ocr.scenario import CalamariScenario
  from calamari_ocr.ocr.training.params import TrainerParams, CalamariDefaultTrainerPipelineParams
  from calamari_ocr.utils.multiprocessing import prefix_run_command, run
label_desc: Use image node_id 1 for calling the CrossFoldTrainerParams obj's underlying member method code with example usage: obj.__post_init__() without return types