class_docstr: The training config, it can be defined in a yaml file
  
  Args:
      output_dir (`str`):
          The output directory where the model predictions and checkpoints will be written.
      overwrite_output_dir (`bool`):
          Overwrite the content of the output directory.
      eval_strategy (`str`):
          The evaluation strategy.
      eval_steps (`int`):
          Run an evaluation every X steps.
      batch_size (`int`):
          Batch size for training.
      val_batch_size (`int`):
          Batch size for evaluation.
      seed (`int`):
          Random seed that will be set at the beginning of training.
      epoch_num (`int`):
          Total number of training epochs to perform.
      dataloader_pin_memory (`bool`):
          Drop the last incomplete batch if it is not divisible by the batch size.
      dataloader_drop_last (`bool`):
          Drop the last incomplete batch if it is not divisible by the batch size.
      dataloader_num_workers (`int`):
          Number of subprocesses to use for data loading.
      lr (`float`):
          The initial learning rate.
      metric (`str`):
          The metric to use to compare two different models.
      print_steps (`int`):
          If None, use the tqdm progress bar, otherwise it will print the logs on the screen every `print_steps`.
      load_best_model_at_end (`bool`):
          Whether or not to load the best model found during training at the end of training.
      early_stopping (`Union[dict, str]`):
          Early stopping.
      model_checkpoint (`Union[dict, str]`):
          Model checkpoint.
      tensorboard (`Union[dict, str]`):
          Tensorboard.
      loss (`Union[str, Dict[str, Any]]`):
          Pytorch loss in torch.nn package.
      optimizer (`Union[str, Dict[str, Any]]`):
          Pytorch optimizer Class name in torch.optim package.
      lr_scheduler_type (`str`):
          The scheduler type to use.
      warmup_ratio (`float`):
          Linear warmup over warmup_ratio fraction of total steps.
      device_str (`str`):
          Device string.
      freeze_bn (`bool`):
          It will completely freeze all BatchNorm layers during training.
class_docstr_tok: ["The","training","config",",","it","can","be","defined","in","a","yaml","file","Args",":","output_dir","(","`","str","`",")",":","The","output","directory","where","the","model","predictions","and","checkpoints","will","be","written",".","overwrite_output_dir","(","`","bool","`",")",":","Overwrite","the","content","of","the","output","directory",".","eval_strategy","(","`","str","`",")",":","The","evaluation","strategy",".","eval_steps","(","`","int","`",")",":","Run","an","evaluation","every","X","steps",".","batch_size","(","`","int","`",")",":","Batch","size","for","training",".","val_batch_size","(","`","int","`",")",":","Batch","size","for","evaluation",".","seed","(","`","int","`",")",":","Random","seed","that","will","be","set","at","the","beginning","of","training",".","epoch_num","(","`","int","`",")",":","Total","number","of","training","epochs","to","perform",".","dataloader_pin_memory","(","`","bool","`",")",":","Drop","the","last","incomplete","batch","if","it","is","not","divisible","by","the","batch","size",".","dataloader_drop_last","(","`","bool","`",")",":","Drop","the","last","incomplete","batch","if","it","is","not","divisible","by","the","batch","size",".","dataloader_num_workers","(","`","int","`",")",":","Number","of","subprocesses","to","use","for","data","loading",".","lr","(","`","float","`",")",":","The","initial","learning","rate",".","metric","(","`","str","`",")",":","The","metric","to","use","to","compare","two","different","models",".","print_steps","(","`","int","`",")",":","If","None",",","use","the","tqdm","progress","bar",",","otherwise","it","will","print","the","logs","on","the","screen","every","`","print_steps","`",".","load_best_model_at_end","(","`","bool","`",")",":","Whether","or","not","to","load","the","best","model","found","during","training","at","the","end","of","training",".","early_stopping","(","`","Union","[","dict",",","str","]","`",")",":","Early","stopping",".","model_checkpoint","(","`","Union","[","dict",",","str","]","`",")",":","Model","checkpoint",".","tensorboard","(","`","Union","[","dict",",","str","]","`",")",":","Tensorboard",".","loss","(","`","Union","[","str",",","Dict","[","str",",","Any","]","]","`",")",":","Pytorch","loss","in","torch.nn","package",".","optimizer","(","`","Union","[","str",",","Dict","[","str",",","Any","]","]","`",")",":","Pytorch","optimizer","Class","name","in","torch.optim","package",".","lr_scheduler_type","(","`","str","`",")",":","The","scheduler","type","to","use",".","warmup_ratio","(","`","float","`",")",":","Linear","warmup","over","warmup_ratio","fraction","of","total","steps",".","device_str","(","`","str","`",")",":","Device","string",".","freeze_bn","(","`","bool","`",")",":","It","will","completely","freeze","all","BatchNorm","layers","during","training","."]
code: def eval_batch_size(self) -> int:
      assert self.batch_size > 0
      if self.val_batch_size == -1:
          return self.batch_size  # * max(1, self.n_gpu)
      else:
          return self.val_batch_size
  
imports: import json
  import os
  from dataclasses import asdict, dataclass, field, fields
  from enum import Enum
  import torch
  from typing import Optional, Dict, Any, Union
  from towhee.utils.log import trainer_log
  from towhee.utils.yaml_utils import dump_yaml, load_yaml
label_desc: Use image node_id 3 for calling the TrainingConfig obj's underlying member method code with example usage: obj.eval_batch_size() and returns: self, self