class_docstr: This class mirrors deepspeed functionality. Not all changes are implemented in this version.
  
  See TorchEngineFull for more modifications.
class_docstr_tok: ["This","class","mirrors","deepspeed","functionality",".","Not","all","changes","are","implemented","in","this","version",".","See","TorchEngineFull","for","more","modifications","."]
docstr: Optionally implement linear batch size ramp-ups.
docstr_tok: ["Optionally","implement","linear","batch","size","ramp-ups","."]
code: def schedule_batch_size(self):
      """Optionally implement linear batch size ramp-ups."""
      if (self.cfg_train.batch_size_ramp > 0) and (
          self.cfg_train.batch_size_ramp < 1
      ):
          # interpret batch_size_ramp as percentage of total budget:
          elapsed_hours = (time.time() - self.initial_time) / 60 / 60
          fake_step = int(
              elapsed_hours
              / self.cfg_train.budget
              * self.cfg_train.steps
          )
  
          batch_size_step = self.cfg_train.batch_size / (
              self.cfg_train.steps * self.cfg_train.batch_size_ramp
          )
          new_batch_size = min(
              int(fake_step * batch_size_step // self.effective_mbs + 1)
              * self.effective_mbs,
              self.cfg_train.batch_size,
          )
      elif self.steps < self.cfg_train.batch_size_ramp:
          # interpret batch_size_ramp as fixed number of steps for ramp:
          batch_size_step = (
              self.cfg_train.batch_size / self.cfg_train.batch_size_ramp
          )
          new_batch_size = (
              int(
                  self.steps * batch_size_step // self.effective_mbs + 1
              )
              * self.effective_mbs
          )
      else:
          new_batch_size = self.cfg_train.batch_size
      self.set_train_batch_size(new_batch_size)
  
imports: import torch
  import torch._inductor.utils
  import os
  import json
  from omegaconf import OmegaConf
  from functools import partial
  from contextlib import nullcontext
  import time
  import logging
  import transformers
  from safetensors.torch import load_file, save_file
  from transformers.utils.generic import working_or_temp_dir
  from torch.distributed.optim import ZeroRedundancyOptimizer
  from .utils import group_parameters, prepare_pretraining_dataloader, update_ema, updated_latest_weight_average
  from .optimizers.schedulers import get_schedule_fn
  from .optimizers import Adahessian, AdamWScale, Shampoo, LARS, SAM, ProgressiveBatching, AGD, Sophia
  import warnings
label_desc: Use image node_id 9 for calling the TorchEngineMinimal obj's underlying member method code with example usage: obj.schedule_batch_size() without return types