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: Replace the module according to the policy, and replace the module one by one
  
  Args:
      model (:class:`torch.nn.Module`): The model to shard
docstr_tok: ["Replace","the","module","according","to","the","policy",",","and","replace","the","module","one","by","one","Args",":","model","(",":","class",":","`","torch.nn.Module","`",")",":","The","model","to","shard"]
code: def _replace_module(
      self, include: Optional[Set[nn.Module]] = None
  ) -> None:
      r"""
      Replace the module according to the policy, and replace the module one by one
  
      Args:
          model (:class:`torch.nn.Module`): The model to shard
      """
      module_descriptions = self.policy.module_policy()
      for layer_cls, module_description in module_descriptions.items():
          attr_replacement = module_description.attribute_replacement
          param_replacement = module_description.param_replacement
          sub_module_replacement = (
              module_description.sub_module_replacement
          )
          method_replacement = module_description.method_replacement
          self._recursive_replace_layer(
              self.model,
              layer_cls,
              attr_replacement,
              param_replacement,
              method_replacement,
              sub_module_replacement,
              include=include,
          )
  
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 5 for calling the ModelSharder obj's underlying member method code with example usage: obj._replace_module(include) without return types