code: def _get_truncated_prompts(
      self, inputs: List[str], max_new_tokens: int
  ) -> List[str]:
      truncated_inputs = copy.deepcopy(inputs)
      # Adapted from https://github.com/THUDM/ChatGLM2-6B/blob/main/ptuning/main.py#L180
      for i, input in enumerate(inputs):
          a_ids = self.tokenizer.encode(
              text=input, add_special_tokens=True, truncation=False
          )
  
          if len(a_ids) > self.model_max_length - max_new_tokens:
              half = (self.model_max_length - max_new_tokens) // 2
              prompt = self.tokenizer.decode(
                  a_ids[:half], skip_special_tokens=True
              ) + self.tokenizer.decode(
                  a_ids[-half:], skip_special_tokens=True
              )
              truncated_inputs[i] = prompt
  
      return truncated_inputs
  
file_path: ColossalAI/applications/ColossalEval/colossal_eval/models/chatglm.py
imports: import copy
  from typing import List
  import torch
  from .huggingface import HuggingFaceModel
label_desc: Use image node_id 1 for calling the ChatGLM2Model obj's underlying member method code with example usage: obj._get_truncated_prompts(inputs, max_new_tokens) and returns: truncated_inputs