class_docstr: DeepSpeed engine for training and inference.
class_docstr_tok: ["DeepSpeed","engine","for","training","and","inference","."]
code: def train(self, mode=True):
      if mode and len(self._orig_modules) > 0:
          for inference_container, orig_module, orig_fwd in zip(
              self._inference_containers,
              self._orig_modules,
              self._orig_fwds,
          ):
              inference_container.transform_for_training()
              orig_module.forward = orig_fwd
          for orig_module, orig_fwd in zip(
              self._orig_modules_others, self._orig_fwds_others
          ):
              orig_module.forward = orig_fwd
      super().train(mode)
      if mode:
          self._training_start_time = time.time()
  
imports: import torch
  from deepspeed.inference.config import DeepSpeedInferenceConfig
  from deepspeed.module_inject.replace_policy import replace_policies
  from deepspeed.module_inject.utils import policy_to_ds_container
  from .engine import DeepSpeedEngine
  from .utils import TLinear, get_inactive_params
  from deepspeed.runtime.zero import GatheredParameters
  import time
  import gc
  import math
  from deepspeed import comm
  from deepspeed.accelerator import get_accelerator
  from torch import nn
  from deepspeed.utils import logger
  from deepspeed.ops.op_builder import InferenceBuilder
  from deepspeed.module_inject.layers import LinearLayer, Normalize, EmbeddingLayer, OPTEmbedding
label_desc: Use image node_id 16 for calling the DeepSpeedHybridEngine obj's underlying member method code with example usage: obj.train(mode) without return types