MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT-LLM / apply_chat_template

Method apply_chat_template

tensorrt_llm/evaluate/lm_eval.py:69–81  ·  view source on GitHub ↗

Method to apply a chat template to a list of chat history between user and model.

(self,
                            chat_history: List[Dict[str, str]],
                            add_generation_prompt: bool = True)

Source from the content-addressed store, hash-verified

67 return self.llm.tokenizer.eos_token_id
68
69 def apply_chat_template(self,
70 chat_history: List[Dict[str, str]],
71 add_generation_prompt: bool = True) -> str:
72 """
73 Method to apply a chat template to a list of chat history between user and model.
74 """
75 return self.llm.tokenizer.apply_chat_template(
76 chat_history,
77 tokenize=False,
78 add_generation_prompt=add_generation_prompt,
79 continue_final_message=not add_generation_prompt,
80 **(self.chat_template_kwargs or {}),
81 )
82
83 @property
84 def tokenizer_name(self) -> str:

Callers 10

sampleMethod · 0.45
sampleMethod · 0.45
preprocess_functionMethod · 0.45
processMethod · 0.45
apply_chat_templateFunction · 0.45

Calls

no outgoing calls