docstr: Implementation of our TP group initialization.
docstr_tok: ["Implementation","of","our","TP","group","initialization","."]
code: def _initialize_tp_group(self):
      """
      Implementation of our TP group initialization.
      """
      init_distributed()
      local_rank = int(os.getenv("LOCAL_RANK", 0))
      get_accelerator().set_device(local_rank)
  
      if local_rank >= self._config.tensor_parallel.tp_size:
          raise RuntimeError(
              "Local rank is greater than TP size, ensure that the TP config is correct."
          )
  
      ranks = list(range(self._config.tensor_parallel.tp_size))
      return dist.new_group(ranks=ranks)
  
imports: import os
  import json
  import pickle
  from typing import Iterable, Tuple
  import torch
  import deepspeed.comm
  from deepspeed.accelerator import get_accelerator
  from deepspeed.comm.comm import init_distributed
  from .model_implementations import InferenceV2Policy
  from .logging import inference_logger
  from .ragged import DSStateManager, RaggedBatchWrapper, PlaceholderSequenceDescriptor
  from .scheduling_utils import SchedulingError, SchedulingResult
  from .model_implementations.flat_model_helpers import make_param_filename, make_metadata_filename
  from .model_implementations.inference_model_base import DSInferenceModelBase
  from .config_v2 import RaggedInferenceEngineConfig
label_desc: Use image node_id 5 for calling the InferenceEngineV2 obj's underlying member method code with example usage: obj._initialize_tp_group() and returns: dist