class_docstr: Inference model implementation for ragged batching for Llama-2 models.
class_docstr_tok: ["Inference","model","implementation","for","ragged","batching","for","Llama-2","models","."]
code: def forward(self, wrapped_batch: RaggedBatchWrapper) -> torch.Tensor:
      residual = self._forward_embed(wrapped_batch)
  
      residual, hidden_states = self.norm(
          residual,
          None,
          gamma=self._transformer[0].ln_gamma,
          beta=self._transformer[0].ln_beta,
      )
  
      for layer_idx in range(self.num_layers):
          residual, hidden_states = self._forward_transformer_layer(
              layer_idx, residual, hidden_states, wrapped_batch
          )
  
      return self._forward_unembed(residual, wrapped_batch)
  
imports: from typing import Iterable, Optional, Tuple
  import torch
  import deepspeed.comm
  from ...allocator import empty_from
  from ...config_v2 import RaggedInferenceEngineConfig
  from ...inference_utils import ActivationType, DtypeEnum
  from ..None import *
  from ...modules.configs import *
  from ...modules.interfaces import *
  from ...modules import heuristics
  from ...ragged import RaggedBatchWrapper
  from ..inference_model_base import DSModelImplementationConfig, MPType
  from .containers import PhiNonTransformerContainer, PhiTransformerContainer
label_desc: Use image node_id 18 for calling the PhiInferenceModel obj's underlying member method code with example usage: obj.forward(wrapped_batch) and returns: self