class_docstr: Wrapper around the BigDL-LLM Transformer-INT4 model
  
  Example:
      .. code-block:: python
  
          from langchain.llms import TransformersLLM
          llm = TransformersLLM.from_model_id(model_id="THUDM/chatglm-6b")
class_docstr_tok: ["Wrapper","around","the","BigDL-LLM","Transformer-INT4","model","Example",":","..","code-block",":",":","python","from","langchain.llms","import","TransformersLLM","llm","=","TransformersLLM.from_model_id","(","model_id=","''","THUDM\/chatglm-6b","''",")"]
docstr: Construct low_bit object from model_id
  
  Args:
  
      model_id: Path for the bigdl transformers low-bit model checkpoint folder.
      model_kwargs: Keyword arguments that will be passed to the model and tokenizer.
      kwargs: Extra arguments that will be passed to the model and tokenizer.
  
  Returns:
      An object of TransformersLLM.
docstr_tok: ["Construct","low_bit","object","from","model_id","Args",":","model_id",":","Path","for","the","bigdl","transformers","low-bit","model","checkpoint","folder",".","model_kwargs",":","Keyword","arguments","that","will","be","passed","to","the","model","and","tokenizer",".","kwargs",":","Extra","arguments","that","will","be","passed","to","the","model","and","tokenizer",".","Returns",":","An","object","of","TransformersLLM","."]
code: def from_model_id_low_bit(
      cls,
      model_id: str,
      model_kwargs: Optional[dict] = None,
      **kwargs: Any,
  ) -> LLM:
      """
      Construct low_bit object from model_id
  
      Args:
  
          model_id: Path for the bigdl transformers low-bit model checkpoint folder.
          model_kwargs: Keyword arguments that will be passed to the model and tokenizer.
          kwargs: Extra arguments that will be passed to the model and tokenizer.
  
      Returns:
          An object of TransformersLLM.
      """
      try:
          from bigdl.llm.transformers import (
              AutoModel,
              AutoModelForCausalLM,
          )
          from transformers import AutoTokenizer, LlamaTokenizer
  
      except ImportError:
          raise ValueError(
              "Could not import transformers python package. "
              "Please install it with `pip install transformers`."
          )
  
      _model_kwargs = model_kwargs or {}
      # TODO: may refactore this code in the future
      try:
          tokenizer = AutoTokenizer.from_pretrained(
              model_id, **_model_kwargs
          )
      except:
          tokenizer = LlamaTokenizer.from_pretrained(
              model_id, **_model_kwargs
          )
  
      # TODO: may refactore this code in the future
      try:
          model = AutoModelForCausalLM.load_low_bit(
              model_id, **_model_kwargs
          )
      except:
          model = AutoModel.load_low_bit(model_id, **_model_kwargs)
  
      if "trust_remote_code" in _model_kwargs:
          _model_kwargs = {
              k: v
              for k, v in _model_kwargs.items()
              if k != "trust_remote_code"
          }
  
      return cls(
          model_id=model_id,
          model=model,
          tokenizer=tokenizer,
          model_kwargs=_model_kwargs,
          **kwargs,
      )
  
file_path: BigDL/python/llm/src/bigdl/llm/langchain/llms/transformersllm.py
imports: import importlib.util
  import logging
  from typing import Any, List, Mapping, Optional
  from pydantic import Extra
  from langchain.callbacks.manager import CallbackManagerForLLMRun
  from langchain.llms.base import LLM
  from langchain.llms.utils import enforce_stop_tokens
label_desc: Use image node_id 2 for calling the TransformersLLM obj's underlying member method code with example usage: obj.from_model_id_low_bit(cls, model_id, model_kwargs) and returns: cls