MCPcopy Index your code
hub / github.com/tinygrad/tinygrad / encode

Method encode

examples/llama3.py:43–44  ·  view source on GitHub ↗
(self, text, allow_special=False)

Source from the content-addressed store, hash-verified

41
42 def decode(self, toks): return self.model.decode([t for t in toks if t < self.num_base_tokens])
43 def encode(self, text, allow_special=False):
44 return self.model.encode(text, allowed_special="all" if allow_special else set(), disallowed_special=set())
45
46# **** helper functions ****
47def concat_weights(models, device=None):

Callers 5

encode_roleFunction · 0.45
encode_messageFunction · 0.45
token_countFunction · 0.45
token_encodeFunction · 0.45
completionsFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected