code: def get_partial_sharded(self, tensor_name: str, dim: int):
      filename, tensor_name = self.get_filename(tensor_name)
      f = self._get_handle(filename)
      slice_ = f.get_slice(tensor_name)
      world_size = self.process_group.size()
      rank = self.process_group.rank()
  
      size = slice_.get_shape()[dim]
      block_size = size // world_size
      start = rank * block_size
      stop = (rank + 1) * block_size
  
      if dim == 0:
          tensor = slice_[start:stop]
      elif dim == 1:
          tensor = slice_[:, start:stop]
      else:
          raise NotImplementedError(
              "Let's make that generic when needed"
          )
      # Special case for gptq which shouldn't convert
      # u4 which are disguised as int32
      if tensor.dtype != torch.int32:
          tensor = tensor.to(dtype=self.dtype)
      tensor = tensor.to(device=self.device)
      return tensor
  
imports: import os
  from pathlib import Path
  from typing import List, Dict, Optional, Tuple
  from safetensors import safe_open, SafetensorError
  import torch
  from loguru import logger
  from huggingface_hub import hf_hub_download
  import json
  from text_generation_server.utils.log import log_once
label_desc: Use image node_id 7 for calling the Weights obj's underlying member method code with example usage: obj.get_partial_sharded(tensor_name, dim) and returns: tensor