class_docstr: Shard the original huggingface model according to the policy
  
  Args:
      policy (:class:`Policy`): The policy to shard the model
      model (:class:`torch.Module`): The model to shard
      shard_config: The setting of distributed model
docstr: Shard the model according to the policy
docstr_tok: ["Shard","the","model","according","to","the","policy"]
code: def shard(self) -> List[Dict[int, Tensor]]:
      r"""
      Shard the model according to the policy
      """
      self.policy.set_model(self.model)
      self.policy.set_shard_config(self.shard_config)
      self._preprocess()
      # get shared params before release unheld layers, this avoid misjudgment of shared params (None is None)
      shared_params = self.policy.get_shared_params()
      held_layers = self._release_unheld_layers()
      self._replace_module(include=held_layers)
      self._materialize()
      self._postprocess()
      return shared_params
  
imports: from types import MethodType
  from typing import Any, Callable, Dict, List, Optional, Set, Union
  import torch.nn
  from torch import Tensor
  from colossalai.lazy import LazyInitContext
  from .._utils import getattr_, setattr_
  from ..policies.auto_policy import get_autopolicy
  from ..policies.base_policy import Policy, SubModuleReplacementDescription
  from .shard_config import ShardConfig
  from .utils import set_tensors_to_none
label_desc: Use image node_id 2 for calling the ModelSharder obj's underlying member method code with example usage: obj.shard() and returns: shared_params