docstr: :param pretrained_model_name_or_path: Path for model checkpoint.
         If running with ``native int4``, the path should be converted BigDL-LLM optimized
         ggml binary checkpoint, which should be converted by ``bigdl.llm.llm_convert``.
         If running with ``transformers int4``, the path should be the huggingface repo id
         to be downloaded or the huggingface checkpoint folder.
  :param native: Load model to either BigDL-LLM optimized Transformer or Native (ggml) int4.
  :param dtype: Which quantized precision will be converted.
         Now only `int4` and `int8` are supported, and `int8` only works for `llama`
         , `gptneox` and `starcoder`.
  :param kwargs: keyword arguments which will be passed to the model instance.
  
  :return: a model instance
docstr_tok: [":","param","pretrained_model_name_or_path",":","Path","for","model","checkpoint",".","If","running","with","``","native","int4","``",",","the","path","should","be","converted","BigDL-LLM","optimized","ggml","binary","checkpoint",",","which","should","be","converted","by","``","bigdl.llm.llm_convert","``",".","If","running","with","``","transformers","int4","``",",","the","path","should","be","the","huggingface","repo","id","to","be","downloaded","or","the","huggingface","checkpoint","folder",".",":","param","native",":","Load","model","to","either","BigDL-LLM","optimized","Transformer","or","Native","(","ggml",")","int4",".",":","param","dtype",":","Which","quantized","precision","will","be","converted",".","Now","only","`","int4","`","and","`","int8","`","are","supported",",","and","`","int8","`","only","works","for","`","llama","`",",","`","gptneox","`","and","`","starcoder","`",".",":","param","kwargs",":","keyword","arguments","which","will","be","passed","to","the","model","instance",".",":","return",":","a","model","instance"]
code: def from_pretrained(
      cls,
      pretrained_model_name_or_path: str,
      native: bool = True,
      dtype: str = "int4",
      *args,
      **kwargs,
  ):
      """
      :param pretrained_model_name_or_path: Path for model checkpoint.
             If running with ``native int4``, the path should be converted BigDL-LLM optimized
             ggml binary checkpoint, which should be converted by ``bigdl.llm.llm_convert``.
             If running with ``transformers int4``, the path should be the huggingface repo id
             to be downloaded or the huggingface checkpoint folder.
      :param native: Load model to either BigDL-LLM optimized Transformer or Native (ggml) int4.
      :param dtype: Which quantized precision will be converted.
             Now only `int4` and `int8` are supported, and `int8` only works for `llama`
             , `gptneox` and `starcoder`.
      :param kwargs: keyword arguments which will be passed to the model instance.
  
      :return: a model instance
      """
      try:
          module = importlib.import_module(cls.GGML_Module)
          class_ = getattr(module, cls.GGML_Model)
          if native:
              invalidInputError(
                  dtype.lower() in ["int4", "int8"],
                  "Now we only support int4 and int8 as date type for weight",
              )
              ggml_model_path = pretrained_model_name_or_path
              model = class_(model_path=ggml_model_path, **kwargs)
          else:
              model = cls.HF_Class.from_pretrained(
                  pretrained_model_name_or_path, *args, **kwargs
              )
      except Exception as e:
          invalidInputError(
              False,
              f"Could not load model from path: {pretrained_model_name_or_path}. "
              f"Please make sure the CausalLM class matches "
              "the model you want to load."
              f"Received error {e}",
          )
      return model
  
file_path: BigDL/python/llm/src/bigdl/llm/transformers/modelling_bigdl.py
imports: import importlib
  import logging
  from bigdl.llm.utils.common import invalidInputError
  from .model import *
label_desc: Use image node_id 1 for calling the _BaseGGMLClass obj's underlying member method code with example usage: obj.from_pretrained(cls, pretrained_model_name_or_path, native, dtype) and returns: model