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","''",")"]
code: def _call(
      self,
      prompt: str,
      stop: Optional[List[str]] = None,
      run_manager: Optional[CallbackManagerForLLMRun] = None,
      **kwargs: Any,
  ) -> str:
      if self.streaming:
          from transformers import TextStreamer
  
          input_ids = self.tokenizer.encode(prompt, return_tensors="pt")
          streamer = TextStreamer(
              self.tokenizer, skip_prompt=True, skip_special_tokens=True
          )
          if stop is not None:
              from transformers.generation.stopping_criteria import (
                  StoppingCriteriaList,
              )
              from transformers.tools.agents import StopSequenceCriteria
  
              # stop generation when stop words are encountered
              # TODO: stop generation when the following one is stop word
              stopping_criteria = StoppingCriteriaList(
                  [StopSequenceCriteria(stop, self.tokenizer)]
              )
          else:
              stopping_criteria = None
          output = self.model.generate(
              input_ids,
              streamer=streamer,
              stopping_criteria=stopping_criteria,
              **kwargs,
          )
          text = self.tokenizer.decode(
              output[0], skip_special_tokens=True
          )
          return text
      else:
          input_ids = self.tokenizer.encode(prompt, return_tensors="pt")
          if stop is not None:
              from transformers.generation.stopping_criteria import (
                  StoppingCriteriaList,
              )
              from transformers.tools.agents import StopSequenceCriteria
  
              stopping_criteria = StoppingCriteriaList(
                  [StopSequenceCriteria(stop, self.tokenizer)]
              )
          else:
              stopping_criteria = None
          output = self.model.generate(
              input_ids, stopping_criteria=stopping_criteria, **kwargs
          )
          text = self.tokenizer.decode(
              output[0], skip_special_tokens=True
          )[len(prompt) :]
          return text
  
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 5 for calling the TransformersLLM obj's underlying member method code with example usage: obj._call(prompt, stop, run_manager) and returns: text, text