class_docstr: API for calling LLM.generate
class_docstr_tok: ["API","for","calling","LLM.generate"]
docstr: Generate response given the prompt
  Args:
      input: input string
      **kwargs: language model keyword type arguments, such as top_k, top_p, temperature, max_new_tokens...
  Returns:
      output: output string
docstr_tok: ["Generate","response","given","the","prompt","Args",":","input",":","input","string","*","*","kwargs",":","language","model","keyword","type","arguments",",","such","as","top_k",",","top_p",",","temperature",",","max_new_tokens","...","Returns",":","output",":","output","string"]
code: def generate(self, input: str, **kwargs) -> str:
      """
      Generate response given the prompt
      Args:
          input: input string
          **kwargs: language model keyword type arguments, such as top_k, top_p, temperature, max_new_tokens...
      Returns:
          output: output string
      """
      if self.model_type in ["chatglm", "chatglm2"]:
          inputs = {
              k: v.to(torch.cuda.current_device())
              for k, v in self.tokenizer(
                  input, return_tensors="pt"
              ).items()
          }
      else:
          inputs = {
              "input_ids": self.tokenizer(input, return_tensors="pt")[
                  "input_ids"
              ].to(torch.cuda.current_device())
          }
  
      output = self.model.generate(**inputs, **kwargs)
      output = output.cpu()
      prompt_len = inputs["input_ids"].size(1)
      response = output[0, prompt_len:]
      output = self.tokenizer.decode(response, skip_special_tokens=True)
      return output
  
imports: from typing import Any, List, Mapping, Optional
  import torch
  from colossalqa.local.utils import get_response, post_http_request
  from colossalqa.mylogging import get_logger
  from langchain.callbacks.manager import CallbackManagerForLLMRun
  from langchain.llms.base import LLM
  from transformers import AutoModelForCausalLM, AutoTokenizer
label_desc: Use image node_id 3 for calling the ColossalAPI obj's underlying member method code with example usage: obj.generate(input) and returns: output