MCPcopy Create free account
hub / github.com/pytorch/executorch / decode

Method decode

examples/models/llama/tokenizer/tiktoken.py:175–186  ·  view source on GitHub ↗

Decodes a list of token IDs into a string. Args: t (List[int]): The list of token IDs to be decoded. Returns: str: The decoded string.

(self, t: Sequence[int])

Source from the content-addressed store, hash-verified

173 return t
174
175 def decode(self, t: Sequence[int]) -> str:
176 """
177 Decodes a list of token IDs into a string.
178
179 Args:
180 t (List[int]): The list of token IDs to be decoded.
181
182 Returns:
183 str: The decoded string.
184 """
185 # Typecast is safe here. Tiktoken doesn't do anything list-related with the sequence.
186 return self.model.decode(cast(List[int], t))
187
188 def decode_token(self, t: int) -> str:
189 """

Callers 6

tok_decodeMethod · 0.45
decode_tokenMethod · 0.45
mainFunction · 0.45
callbackFunction · 0.45
mainFunction · 0.45
test_llava_exportMethod · 0.45

Calls

no outgoing calls

Tested by 2

mainFunction · 0.36
test_llava_exportMethod · 0.36