class_docstr: Model wrapper around HuggingFace AutoModel models.
  
  Args:
      path: The path to a HuggingFace model.
      model_max_length: The maximum sequence length of the model.
      tokenizer_path: The path to the tokenizer.
      tokenizer_kwargs: Keyword arguments for the tokenizer.
      peft_path: The name or path to the HuggingFace's PEFT model.
      model_kwargs: Keyword arguments for the model.
      prompt_template: The model's prompt template.
      batch_size: Batch size for inference.
      logger: Logger for the model.
      shard_config: Shard config for tensor parallel.
class_docstr_tok: ["Model","wrapper","around","HuggingFace","AutoModel","models",".","Args",":","path",":","The","path","to","a","HuggingFace","model",".","model_max_length",":","The","maximum","sequence","length","of","the","model",".","tokenizer_path",":","The","path","to","the","tokenizer",".","tokenizer_kwargs",":","Keyword","arguments","for","the","tokenizer",".","peft_path",":","The","name","or","path","to","the","HuggingFace","'s","PEFT","model",".","model_kwargs",":","Keyword","arguments","for","the","model",".","prompt_template",":","The","model","'s","prompt","template",".","batch_size",":","Batch","size","for","inference",".","logger",":","Logger","for","the","model",".","shard_config",":","Shard","config","for","tensor","parallel","."]
code: def __init__(
      self,
      path: str,
      model_max_length: int = 2048,
      tokenizer_path: Optional[str] = None,
      tokenizer_kwargs: dict = dict(),
      peft_path: Optional[str] = None,
      model_kwargs: Dict = None,
      prompt_template: Conversation = None,
      batch_size: int = 1,
      logger: DistributedLogger = None,
      shard_config: ShardConfig = None,
  ):
      super().__init__(
          path=path,
          model_max_length=model_max_length,
          prompt_template=prompt_template,
          batch_size=batch_size,
          logger=logger,
      )
      self._load_tokenizer(
          path=path,
          tokenizer_path=tokenizer_path,
          tokenizer_kwargs=tokenizer_kwargs,
      )
  
      self._load_model(
          path=path,
          model_kwargs=model_kwargs,
          peft_path=peft_path,
          shard_config=shard_config,
      )
  
imports: import copy
  import math
  from typing import Any, Dict, List, Optional, Tuple
  import numpy
  import torch
  from colossal_eval.utils import Conversation, get_batch_prompt, is_rank_0
  from peft import PeftModel
  from tqdm import tqdm
  from transformers import AutoConfig, AutoModel, AutoModelForCausalLM, AutoTokenizer
  from colossalai.logging import DistributedLogger
  from colossalai.shardformer import ShardConfig, ShardFormer
  from .base import BaseModel
label_desc: Use image node_id 1 to create a new HuggingFaceModel object from inherited base classes: BaseModel with example: obj = HuggingFaceModel(path, model_max_length, tokenizer_path, tokenizer_kwargs, peft_path, model_kwargs, prompt_template, batch_size, logger, shard_config)