class_docstr: DeepSpeed engine for training and inference.
class_docstr_tok: ["DeepSpeed","engine","for","training","and","inference","."]
code: def create_inference_containers(self, module, layer_id=0):
      for name, child in module.named_children():
          if child.__class__ in self.inference_policies:
              if (
                  self.inference_policies[child.__class__][0]
                  == self.new_inference_container
              ):
                  self._inference_containers.append(
                      self.inference_policies[child.__class__][0](
                          child,
                          self.inference_policies[child.__class__][-1],
                          layer_id,
                      )
                  )
                  self._orig_modules.append(child)
                  self._orig_fwds.append(child.forward)
  
                  self.layer_params.append(
                      self._inference_containers[
                          layer_id
                      ].get_all_params()
                  )
  
                  self.lora_params.append(
                      self._inference_containers[
                          layer_id
                      ].get_lora_params()
                  )
                  self.layer_lora_params.append([])
                  for lora_param in self.lora_params[layer_id]:
                      self.layer_lora_params[layer_id].extend(
                          lora_param[:-1]
                      )
                      self.all_lora_params.extend(lora_param[:-1])
  
                  layer_id += 1
              else:
                  self._other_layers.append(
                      self.inference_policies[child.__class__][0](
                          weight=child.weight,
                          bias=child.bias
                          if hasattr(child, "bias")
                          else None,
                      )
                  )
                  self._orig_modules_others.append(child)
                  self._orig_fwds_others.append(child.forward)
          else:
              self.create_inference_containers(child, layer_id=layer_id)
  
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 12 for calling the DeepSpeedHybridEngine obj's underlying member method code with example usage: obj.create_inference_containers(module, layer_id) without return types