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

Method _encode

tensorrt_llm/sampling_params.py:380–385  ·  view source on GitHub ↗
(tokenizer, text, add_special_tokens)

Source from the content-addressed store, hash-verified

378 self.pad_id = self.end_id
379
380 def _encode(tokenizer, text, add_special_tokens):
381 try:
382 return tokenizer.encode(text, add_special_tokens=add_special_tokens)
383 except TypeError:
384 # For tiktokenizer, the encode method does not have add_special_tokens argument
385 return tokenizer.encode(text)
386
387 if self.bad is not None:
388 strs = [self.bad] if isinstance(self.bad, str) else self.bad

Callers

nothing calls this directly

Calls 1

encodeMethod · 0.45

Tested by

no test coverage detected