class_docstr: Replace original Huggingface's layer into Megatron tensor sliced layer.
  
  Args:
      model (nn.Module): Huggingface pre-trained transformer model
      mp_group (Any): process group for model parallelism
      fp16: (bool): Whether use FP16 or not.
      num_gpus (int): number of GPUs
      custom_policies (Union[Policy, List[Policy]]): custom policy object (default=None)
class_docstr_tok: ["Replace","original","Huggingface","'s","layer","into","Megatron","tensor","sliced","layer",".","Args",":","model","(","nn.Module",")",":","Huggingface","pre-trained","transformer","model","mp_group","(","Any",")",":","process","group","for","model","parallelism","fp16",":","(","bool",")",":","Whether","use","FP16","or","not",".","num_gpus","(","int",")",":","number","of","GPUs","custom_policies","(","Union","[","Policy",",","List","[","Policy","]","]",")",":","custom","policy","object","(","default=None",")"]
docstr: Find the proper policy for current model using AutoPolicy
docstr_tok: ["Find","the","proper","policy","for","current","model","using","AutoPolicy"]
code: def auto_policy(self) -> Optional[List[Policy]]:
      """Find the proper policy for current model using AutoPolicy"""
  
      auto = AutoPolicy()
      policy_cls = auto.get_policy(self.model)
  
      assert policy_cls is not None, (
          f"{self.model.__class__.__qualname__} is not supported yet.\n"
          f"Currently we support {[i.__qualname__ for i in auto.available().keys()]}.\n"
          f"To apply to unsupported models, you need to create a custom Policy object."
      )
  
      return policy_cls
  
file_path: parallelformers/parallelformers/parallel/replacing.py
imports: from contextlib import suppress
  from typing import Any, Dict, Iterable, List, Optional, Tuple, Type, Union
  import torch.nn
  from torch import Size, Tensor
  from parallelformers.parallel.slicing import TensorSlicer
  from parallelformers.policies.base import Layer, Policy
  from parallelformers.policies.base.auto import AutoPolicy
  from parallelformers.utils import rgetattr, rhasattr, rsetattr
label_desc: Use image node_id 2 for calling the TensorReplacer obj's underlying member method code with example usage: obj.auto_policy() and returns: policy_cls