MCPcopy Create free account
hub / github.com/abetlen/llama-cpp-python / tokenize

Method tokenize

llama_cpp/llama_tokenizer.py:81–86  ·  view source on GitHub ↗
(
        self, text: bytes, add_bos: bool = True, special: bool = True
    )

Source from the content-addressed store, hash-verified

79 self.hf_tokenizer = hf_tokenizer
80
81 def tokenize(
82 self, text: bytes, add_bos: bool = True, special: bool = True
83 ) -> List[int]:
84 return self.hf_tokenizer.encode(
85 text.decode("utf-8", errors="ignore"), add_special_tokens=special
86 )
87
88 def detokenize(
89 self,

Callers

nothing calls this directly

Calls 2

encodeMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected