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
class_docstr_tok: ["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"]
code: def __init__(
      self,
      model: nn.Module,
      policy: Policy,
      shard_config: ShardConfig = None,
  ) -> None:
      self.model = model
      self.shard_config = shard_config
      self.policy = (
          get_autopolicy(self.model) if policy is None else policy
      )
  
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 1 to create a new ModelSharder object from inherited base classes: object with example: obj = ModelSharder(model, policy, shard_config)